1--TEST--
2ZE2 Constructor precedence
3--SKIPIF--
4<?php if (version_compare(zend_version(), '2.0.0-dev', '<')) die('skip ZendEngine 2 needed'); ?>
5--FILE--
6<?php
7class Base_php4 {
8  function Base_php4() {
9    var_dump('Base constructor');
10  }
11}
12
13class Child_php4 extends Base_php4 {
14  function Child_php4() {
15    var_dump('Child constructor');
16    parent::Base_php4();
17  }
18}
19
20class Base_php5 {
21  function __construct() {
22    var_dump('Base constructor');
23  }
24  }
25
26class Child_php5 extends Base_php5 {
27  function __construct() {
28    var_dump('Child constructor');
29    parent::__construct();
30  }
31  }
32
33class Child_mx1 extends Base_php4 {
34  function __construct() {
35    var_dump('Child constructor');
36    parent::Base_php4();
37  }
38}
39
40class Child_mx2 extends Base_php5 {
41  function Child_mx2() {
42    var_dump('Child constructor');
43    parent::__construct();
44  }
45}
46
47echo "### PHP 4 style\n";
48$c4= new Child_php4();
49
50echo "### PHP 5 style\n";
51$c5= new Child_php5();
52
53echo "### Mixed style 1\n";
54$cm= new Child_mx1();
55
56echo "### Mixed style 2\n";
57$cm= new Child_mx2();
58?>
59--EXPECTF--
60Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base_php4 has a deprecated constructor in %s on line %d
61
62Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_php4 has a deprecated constructor in %s on line %d
63
64Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Child_mx2 has a deprecated constructor in %s on line %d
65### PHP 4 style
66string(17) "Child constructor"
67string(16) "Base constructor"
68### PHP 5 style
69string(17) "Child constructor"
70string(16) "Base constructor"
71### Mixed style 1
72string(17) "Child constructor"
73string(16) "Base constructor"
74### Mixed style 2
75string(17) "Child constructor"
76string(16) "Base constructor"
77