]> granicus.if.org Git - php/commitdiff
Finish PHP 4 constructor deprecation
authorNikita Popov <nikic@php.net>
Tue, 31 Mar 2015 14:10:06 +0000 (16:10 +0200)
committerNikita Popov <nikic@php.net>
Tue, 31 Mar 2015 15:55:27 +0000 (17:55 +0200)
53 files changed:
Zend/tests/bug31177-2.phpt
Zend/tests/bug38942.phpt
Zend/tests/bug39127.phpt
Zend/tests/bug40784.phpt
Zend/tests/bug43323.phpt
Zend/tests/bug46381.phpt
Zend/tests/bug47343.phpt
Zend/tests/bug48215_2.phpt
Zend/tests/bug50261.phpt
Zend/tests/bug52051.phpt
Zend/tests/bug52160.phpt
Zend/tests/dynamic_call_001.phpt
Zend/tests/get_class_methods_001.phpt
Zend/tests/get_class_methods_003.phpt
Zend/tests/objects_010.phpt
Zend/tests/return_types/023.phpt
Zend/tests/traits/bug55554b.phpt
Zend/tests/traits/noctor001.phpt
Zend/zend_compile.c
ext/mbstring/tests/common.inc
ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt
ext/reflection/tests/004.phpt
ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt
ext/reflection/tests/ReflectionClass_isInstantiable_error.phpt
ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt
ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt
ext/reflection/tests/ReflectionClass_newInstance_001.phpt
ext/reflection/tests/ReflectionMethod_constructor_basic.phpt
ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt
ext/reflection/tests/ReflectionObject_isInstantiable_error.phpt
ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt
ext/reflection/tests/bug30148.phpt
ext/reflection/tests/bug36434.phpt
ext/reflection/tests/bug38942.phpt
ext/reflection/tests/bug47254.phpt
ext/reflection/tests/parameters_002.phpt
ext/session/tests/017.phpt
ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt
ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt
ext/soap/tests/server006.phpt
ext/soap/tests/server008.phpt
ext/soap/tests/server027.phpt
ext/standard/tests/filters/read.phpt
ext/xsl/tests/xslt011.phpt
tests/classes/ctor_name_clash.phpt
tests/classes/final_ctor1.phpt
tests/classes/final_ctor2.phpt
tests/classes/final_ctor3.phpt
tests/classes/inheritance_002.phpt
tests/classes/inheritance_005.phpt
tests/classes/inheritance_007.phpt
tests/lang/bug27535.phpt

index 10083c59edc87b6bd4fd06d27ff5af4ea84c2be2..6cba62cedf17d2b2c7e1859e7bdfeb0335b94e89 100644 (file)
@@ -3,13 +3,13 @@ Bug #31177 (memory corruption because of incorrect refcounting)
 --FILE--
 <?php
 class foo {
-  function foo($n=0) {
+  function __construct($n=0) {
     if($n) throw new Exception("new");
   }
 }
 $x = new foo();
 try {
-  $y=$x->foo(1);
+  $y=$x->__construct(1);
 } catch (Exception $e) {
   var_dump($x);
 }
index 85bb56d2001c9fdbf62a83a8f1470395085470af..d0335b1071c8350526b1fdb38885bbaf607aa2fa 100644 (file)
@@ -10,7 +10,8 @@ class bar extends foo {
 }
 print_r(get_class_methods("bar"));
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d
 Array
 (
     [0] => foo
index a013da145e5a5cf6076141b8bb0fd5f01e12f3bc..2f5b0fd2bfea514a6a0c1229fc92dc209af210f7 100644 (file)
@@ -14,6 +14,7 @@ var_dump(is_callable(array($b,"__construct")));
 echo "Done\n";
 ?>
 --EXPECTF--    
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; a has a deprecated constructor in %s on line %d
 string(13) "a::a() called"
 bool(true)
 bool(false)
index 6da8f2a16ba12fcf84819964fe35ed861844812a..a103d4a01cc14ae744199920b2aa8cddfe29cfcf 100644 (file)
@@ -19,6 +19,7 @@ $b = new B;
 echo "Done\n";
 ?>
 --EXPECTF--    
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
 I'm A
 I'm A
 Done
index d366a6dd1ff5265d3693d8e5a798d07bce6a040f..74abe766e57bfb61261b2723fde69f732ad4f952 100644 (file)
@@ -9,4 +9,6 @@ abstract class bar {
 class foo extends bar {
 }
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; bar has a deprecated constructor in %s on line %d
+
 Fatal error: Class foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (bar::bar) in %sbug43323.php on line 7
index 4d58e9fdf310cb4e3257e5e73a177de1f782e205..6479d0c8a403cb18d33bb85b5bb87f21da8f3353 100644 (file)
@@ -1,17 +1,15 @@
 --TEST--
 Bug #46381 (wrong $this passed to internal methods causes segfault)
---SKIPIF--
-<?php if (!extension_loaded("spl")) die("skip SPL is no available"); ?>
 --FILE--
 <?php
 
 class test {
-       public function test() {
+       public function method() {
                return ArrayIterator::current();
        }
 }
 $test = new test();
-$test->test();
+$test->method();
 
 echo "Done\n";
 ?>
index 07a3b4e330630292380712f115a32233312ad430..b0b7977beb3c66ad74af2a3993c30f7368c38224 100644 (file)
@@ -20,7 +20,7 @@ class A
 
 class B
 {
-       public function B($A)
+       public function __construct($A)
        {
                $this->A = $A;
        }
index 199a252208d058dc36f3b647ea42c693ef37b3f4..da6b7a84b650e4966acf2a83b86d3b18974ac251 100644 (file)
@@ -8,7 +8,7 @@ class a {
 }
 class b extends a {}
 class c extends b { 
-       function C() {
+       function __construct() {
                b::b();
        }
 }
index 271a2c4805976ada5b7925099e5a18017b2907bb..ce120b9416ed1bc67f5c74362be7877c14a81747 100644 (file)
@@ -30,7 +30,8 @@ class testClass2 extends testClass {
 new testClass2;
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; testClass has a deprecated constructor in %s on line %d
 testClass::testClass (1)
 testClass::testClass (2)
 testClass::testClass (3)
index e8a4f49e3ce46a40169ebad81868dd4c17fe44e1..acfddbc36d9abbe13edcc52568934b9123bec2db 100644 (file)
@@ -22,6 +22,13 @@ class C extends B {
 new C();
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; AA has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; CC has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
 foo
 bar
index c85d2f09afb6030a772b60955943d089e7240493..a0e5a9d7ae23b1954d2a980250bec273f26bc7e5 100644 (file)
@@ -29,6 +29,6 @@ class baz {
 
 ?>
 --EXPECTF--
-Strict Standards: Redefining already defined constructor for class foo in %s on line %d
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; baz has a deprecated constructor in %s on line %d
 
 Fatal error: Constructor baz::baz() cannot be static in %s on line %d
index 94e4203caff6bb3b9572d4a1c0309610e0e60a23..9a22dc2c6b0c1de051fc5931df401c76d32d626b 100644 (file)
@@ -14,4 +14,6 @@ $a::$a();
 
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d
+
 Fatal error: Non-static method foo::foo() cannot be called statically in %s on line %d
index 277ea2cf5ae04006f7fba7ae19ab99c1d48172cd..a2a3d0ca209b139697a74f729f39209161740c7f 100644 (file)
@@ -3,30 +3,30 @@ get_class_methods(): Testing scope
 --FILE--
 <?php
 
-abstract class A { 
+abstract class X { 
        public function a() { }
        private function b() { }
        protected function c() { }      
 }
 
-class B extends A {
+class Y extends X {
        private function bb() { }
        
        static public function test() { 
-               var_dump(get_class_methods('A'));
-               var_dump(get_class_methods('B'));
+               var_dump(get_class_methods('X'));
+               var_dump(get_class_methods('Y'));
        }
 }
 
 
-var_dump(get_class_methods('A'));
-var_dump(get_class_methods('B'));
+var_dump(get_class_methods('X'));
+var_dump(get_class_methods('Y'));
 
 
-B::test();
+Y::test();
 
 ?>
---EXPECT--
+--EXPECTF--
 array(1) {
   [0]=>
   string(1) "a"
index bbb758625b269e7b1cb29fafc6c624a6424a636e..5c3c09f4e07215b22965a763cf4beaab2d602b6e 100644 (file)
@@ -3,13 +3,13 @@ get_class_methods(): Testing scope
 --FILE--
 <?php
 
-interface A { 
+interface I { 
        function aa();
        function bb();
        static function cc();
 }
 
-class C {
+class X {
        public function a() { }
        protected function b() { }
        private function c() { }
@@ -19,22 +19,22 @@ class C {
        static private function static_c() { }
 }
 
-class B extends C implements A {
+class Y extends X implements I {
        public function aa() { }
        public function bb() { }
        
        static function cc() { }
        
        public function __construct() {
-               var_dump(get_class_methods('A'));
-               var_dump(get_class_methods('B'));
-               var_dump(get_class_methods('C'));
+               var_dump(get_class_methods('I'));
+               var_dump(get_class_methods('Y'));
+               var_dump(get_class_methods('X'));
        }
        
        public function __destruct() { }
 }
 
-new B;
+new Y;
 
 ?>
 --EXPECT--
index 5d004629d90dd35385b326b0d3730f925c509c31..0f85498e2c9a00b1ba8206573e74eacd685b90b4 100644 (file)
@@ -1,7 +1,5 @@
 --TEST--
 redefining constructor (__construct second)
---INI--
-error_reporting=8191
 --FILE--
 <?php
 
@@ -15,5 +13,4 @@ class test {
 echo "Done\n";
 ?>
 --EXPECTF--    
-Strict Standards: Redefining already defined constructor for class test in %s on line %d
 Done
index 61a9e1c4e098d7dfb9548a23cfc30830042c16c6..9e36bf7c0405b801467bec533d2360432e6e578b 100644 (file)
@@ -9,4 +9,6 @@ class Foo {
 }
 
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Foo has a deprecated constructor in %s on line %d
+
 Fatal error: Constructor %s::%s() cannot declare a return type in %s on line %s
index bf40e89a084ba76209a6c5bdbaf55404cb233e4f..06229bac340433ba83b110df7db96ae44c730c6a 100644 (file)
@@ -50,6 +50,8 @@ $o = new ReportCollision;
 
 --EXPECTF--
 OverridingIsSilent1 __construct
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OverridingIsSilent2 has a deprecated constructor in %s on line %d
 OverridingIsSilent2 OverridingIsSilent2
 
 Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d
index d15acff87acd367950312720a2aea2c33d366a3a..19fe8dbd0d44d1b187f260007228d2c647c8da13 100644 (file)
@@ -22,7 +22,8 @@ var_dump($rbarfoo->isConstructor());
 $rbarbar = new ReflectionMethod('Bar::Bar');
 var_dump($rbarbar->isConstructor());
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Bar has a deprecated constructor in %s on line %d
 bool(false)
 bool(false)
 bool(true)
index ad696857b4dc8a1a568d5c152f7ad87e4c43054d..b1dcfcd66bb8091f5f2758c741eb937326f5f2af 100644 (file)
@@ -4947,6 +4947,11 @@ void zend_compile_class_decl(zend_ast *ast) /* {{{ */
 
        zend_compile_stmt(stmt_ast);
 
+       if (ce->num_traits == 0) {
+               /* For traits this check is delayed until after trait binding */
+               zend_check_deprecated_constructor(ce);
+       }
+
        if (ce->constructor) {
                ce->constructor->common.fn_flags |= ZEND_ACC_CTOR;
                if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) {
index 1df63410773832dc105d52a02bc9c9b4953c0ea6..a40dde039912eaf36ebb783eb5e170e916f8f77d 100644 (file)
@@ -45,7 +45,7 @@ class tc
        public $s1 = 'ÆüËܸìEUC-JP¤Îʸ»úÎó';
        public $s2 = 'English Text';
 
-       function tc() 
+       function __construct() 
        {
        }
 }
index c297f8ff67363b763415a49453f26d916dff1a0d..b8efec5eca9741327e01c5840e8d37c6660982c9 100644 (file)
@@ -220,7 +220,7 @@ require_once('skipifconnectfailure.inc');
                private $id;
                public $id_ref;
                public function __construct() {
-                       parent::construct();
+                       parent::__construct();
                        $this->id_ref = &$this->id;
                }
        }
index efcb2e7bcc3f855e78e8f34da2554d37eddd82e0..f7f3ce06bce0b3fe65028561f476783d346f96d1 100644 (file)
@@ -34,14 +34,14 @@ $st = $db->query('SELECT * FROM testing');
 var_dump($st->fetchAll(PDO::FETCH_FUNC, array('self', 'foo')));
 
 class foo { 
-       public function foo($x) {
+       public function method($x) {
                return "--- $x ---";
        }
 }
 class bar extends foo {
        public function __construct($db) {
                $st = $db->query('SELECT * FROM testing');
-               var_dump($st->fetchAll(PDO::FETCH_FUNC, array($this, 'parent::foo')));
+               var_dump($st->fetchAll(PDO::FETCH_FUNC, array($this, 'parent::method')));
        }
        
        static public function test($x, $y) {
index 2c81c506bea3008dfc88b317a7245e4971340008..41632aa3bab954352be739859216cc44ea8cce28 100644 (file)
@@ -36,7 +36,8 @@ try {
 }
 
 echo "===DONE===\n";?>
---EXPECT--
+--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; a has a deprecated constructor in %s on line %d
 Non-object passed to Invoke()
 Given object is not an instance of the class this method was declared in
 ===DONE===
index 1f5ba432c3cf462a6416c43773b378de635f7650..c572796ae8df49472958ea19e4e891beffe90869 100644 (file)
@@ -64,7 +64,11 @@ foreach ($classes as $class) {
                                 
 ?>
 --EXPECTF--
-Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line %d
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
 Constructor of NewCtor: __construct
 Constructor of ExtendsNewCtor: __construct
 Constructor of OldCtor: OldCtor
index 52be239121500cf693a38c6a9e2695d750dc3339..5263643023838ba82c81ccc007c0e66921bc6d5a 100644 (file)
@@ -12,6 +12,8 @@ var_dump($reflectionClass->IsInstantiable(0, null));
 
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d
+
 Warning: ReflectionClass::isInstantiable() expects exactly 0 parameters, 1 given in %s on line %d
 NULL
 
index 1cf3e613e81e5d63651c69bc4bf058955299dcfc..e334a90a728e8a8e31cb8bc33d6db19d3b63a386 100644 (file)
@@ -41,6 +41,11 @@ foreach($classes  as $class ) {
 
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; protectedCtorOld has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d
 Is noCtor instantiable?  bool(true)
 Is publicCtorNew instantiable?  bool(true)
 Is protectedCtorNew instantiable?  bool(false)
index 981d67519a2a32c059859e26944876a1acdf9f61..d3a426de4c02f42562e56c3502d3b8f57e60260c 100644 (file)
@@ -71,6 +71,7 @@ try {
 }
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
 In constructor of class A
 In constructor of class A
 object(A)#%d (0) {
@@ -95,4 +96,4 @@ Access to non-public constructor of class C
 Access to non-public constructor of class D
 object(E)#%d (0) {
 }
-Class E does not have a constructor, so you cannot pass any constructor arguments
\ No newline at end of file
+Class E does not have a constructor, so you cannot pass any constructor arguments
index 3cdb5d76b742690d7463197d4b1cf7f1c3e4c9e5..afa278a9a19a5a55416d0a89068bd83a79f41be3 100644 (file)
@@ -71,6 +71,7 @@ try {
 }
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
 In constructor of class A
 In constructor of class A
 object(A)#%d (0) {
@@ -95,4 +96,4 @@ Access to non-public constructor of class C
 Access to non-public constructor of class D
 object(E)#%d (0) {
 }
-Class E does not have a constructor, so you cannot pass any constructor arguments
\ No newline at end of file
+Class E does not have a constructor, so you cannot pass any constructor arguments
index 2a2f02ffe05718a05b507d6a1e7c40d3fda8b4dd..243c59504be0dd8e8febbff6a8cbde2b2d51ae64 100644 (file)
@@ -85,7 +85,7 @@ var_dump($methodInfo->isConstructor());
 
 ?>
 --EXPECTF--
-Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line %d
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
 New-style constructor:
 bool(true)
 
index 5a0c36f9eec264fb0bbcc53122e4cbd3a2490f29..2fb43562bbfee717d1d3e2369a9bc7b4ab47d4dc 100644 (file)
@@ -64,7 +64,11 @@ foreach ($classes as $class) {
                                
 ?>
 --EXPECTF--
-Strict Standards: Redefining already defined constructor for class OldAndNewCtor in %s on line %d
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; OldCtor has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; C has a deprecated constructor in %s on line %d
 Constructor of NewCtor: __construct
 Constructor of ExtendsNewCtor: __construct
 Constructor of OldCtor: OldCtor
index f993367b2d533bd01fdb65b3bdf0a4f8eaa02ad3..c77c039d4d5d4ce971316449cf03ecd406db9fae 100644 (file)
@@ -15,6 +15,8 @@ var_dump($reflectionObject->IsInstantiable(0, null));
 
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d
+
 Warning: ReflectionClass::isInstantiable() expects exactly 0 parameters, 1 given in %s on line %d
 NULL
 
index ac7199c096cf9b87d5701ca556a297fc975f5cea..1e5be5929933c69037193a00ca31a5231520eee9 100644 (file)
@@ -69,6 +69,11 @@ foreach($reflectionObjects  as $reflectionObject ) {
 }
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; publicCtorOld has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; protectedCtorOld has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; privateCtorOld has a deprecated constructor in %s on line %d
 Is noCtor instantiable? bool(true)
 Is publicCtorNew instantiable? bool(true)
 Is protectedCtorNew instantiable? bool(false)
index aa5841ee5bebd7114327051b415385a58c9d4d38..27c31ca6aecb47347e0854e4e6b070bbe03ead96 100644 (file)
@@ -26,7 +26,8 @@ var_dump($d->isConstructor());
 var_dump($e->isConstructor());
 ?>
 ===DONE===
---EXPECT--
+--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Root has a deprecated constructor in %s on line %d
 bool(true)
 bool(false)
 bool(true)
index 218055d546743a3dfb55b395e53cfc51ec9dd93a..9598a40b7b1b29459382f5f5ad240edce54b59b5 100644 (file)
@@ -4,16 +4,16 @@ Reflection Bug #36434 (Properties from parent class fail to indetify their true
 <?php
 class ancester
 {
-public $ancester = 0;
-       function ancester()
+    public $ancester = 0;
+       function __construct()
        {
                return $this->ancester;
        }
 }
 class foo extends ancester
 {
-public $bar = "1";
-       function foo()
+    public $bar = "1";
+       function __construct()
        {
                return $this->bar;
        }
index 817190c997041837ea942351836e63fbd686ddd6..59666607cb8f1f635662368cde54163dee56734c 100644 (file)
@@ -11,6 +11,7 @@ class bar extends foo {
 ReflectionClass::export("bar");
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; foo has a deprecated constructor in %s on line %d
 Class [ <user> class bar extends foo ] {
   @@ %sbug38942.php 6-7
 
index 83593a4ff27ce614c8377b6d4770f295f798bc99..38cdcd62b4578cde93e47b4c8ce39ddc94aa777a 100644 (file)
@@ -23,7 +23,10 @@ $m = $R->getMethods();
 print_r($m);
 
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
+
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; B has a deprecated constructor in %s on line %d
 Array
 (
     [0] => ReflectionMethod Object
index a86191042f8f5be4f8434ec139773b9d56398ecf..ae924323a0d4e6e37af7494272490b677746db58 100644 (file)
@@ -3,13 +3,15 @@ ReflectionParameter::getClass(), getDeclaringClass(), getDeclaringFunction()
 --FILE--
 <?php
 
-function test($nix, Array $ar, &$ref, stdClass $std, NonExistingClass $na, stdClass &$opt = NULL, $def = "FooBar")
+function test($nix, Array $ar, &$ref, stdClass $std,
+    NonExistingClass $na, stdClass &$opt = NULL, $def = "FooBar")
 {
 }
 
 class test
 {
-       function test($nix, Array $ar, &$ref, stdClass $std, NonExistingClass $na, stdClass $opt = NULL, $def = "FooBar")
+       function method($nix, Array $ar, &$ref, stdClass $std,
+        NonExistingClass $na, stdClass $opt = NULL, $def = "FooBar")
        {
        }
 }
@@ -17,7 +19,8 @@ class test
 function check_params_decl_func($r, $f)
 {
        $c = $r->$f();
-       echo $f . ': ' . ($c ? ($c instanceof ReflectionMethod ? $c->class . '::' : '') . $c->name : 'NULL') . "()\n";
+    $sep = $c instanceof ReflectionMethod ? $c->class . '::' : '';
+       echo $f . ': ' . ($c ? $sep . $c->name : 'NULL') . "()\n";
 }
 
 function check_params_decl_class($r, $f)
@@ -66,7 +69,7 @@ function check_params($r)
 
 check_params(new ReflectionFunction('test'));
 
-check_params(new ReflectionMethod('test::test'));
+check_params(new ReflectionMethod('test::method'));
 
 ?>
 ===DONE===
@@ -138,7 +141,7 @@ allowsNull: bool(true)
 isOptional: bool(true)
 isDefaultValueAvailable: bool(true)
 getDefaultValue: string(6) "FooBar"
-#####test::test()#####
+#####test::method()#####
 ===0===
 getName: string(3) "nix"
 isPassedByReference: bool(false)
index dbe53f5698f9bbaff394e902c71f9782c628037c..baf7df8c574bff10b9900168b9b8132e08738305 100644 (file)
@@ -13,7 +13,7 @@ session.save_handler=files
 error_reporting(E_ALL);
 
 class Kill {
-       function Kill() {
+       function __construct() {
                global $HTTP_SESSION_VARS;
                session_start();
        }
index e1052dfa9a707dbd9fb866227f4066456156aa87..efbad5a1211fe0e0681e876541947c055121289b 100644 (file)
@@ -7,7 +7,7 @@ precision=14
 --FILE--
 <?php
 class SOAPStruct {
-    function SOAPStruct($s, $i, $f) {
+    function __construct($s, $i, $f) {
         $this->varString = $s;
         $this->varInt = $i;
         $this->varFloat = $f;
index ade6d8329e50182f3790bca5761607f4a676c12b..1c798aaf97f77662318275bcbbc03c8a0abd31b9 100644 (file)
@@ -7,7 +7,7 @@ soap.wsdl_cache_enabled=0
 --FILE--
 <?php
 class SOAPList {
-    function SOAPList($s, $i, $c) {
+    function __construct($s, $i, $c) {
         $this->varString = $s;
         $this->varInt = $i;
         $this->child = $c;
index da328ebfeeb1b695467e49ba5977572ed6ef730d..0c94fb299334ffe96eaedc1832512bdc216d4e4c 100644 (file)
@@ -7,7 +7,7 @@ SOAP Server 6: setclass with constructor
 class Foo {
   private $str = "";
 
-  function Foo($str) {
+  function __construct($str) {
     $this->str = $str . " World";
   }
 
index 87fb69d25fa6992b3577ec9de0fcb1abf4ff6cac..d299a3ae9b03d70c712a349224da0609b78ed9bc 100644 (file)
@@ -6,7 +6,7 @@ SOAP Server 8: setclass and getfunctions
 <?php
 class Foo {
 
-  function Foo() {
+  function __construct() {
   }
 
   function test() {
@@ -22,7 +22,7 @@ echo "ok\n";
 --EXPECT--
 array(2) {
   [0]=>
-  string(3) "Foo"
+  string(11) "__construct"
   [1]=>
   string(4) "test"
 }
index 9fee4a6087c1ce0c5432a35a9d4499b6a700afd5..188b94f10ed4777774a3ba479d2678599e9db4cf 100644 (file)
@@ -6,7 +6,7 @@ SOAP Server 27: setObject and getFunctions
 <?php
 class Foo {
 
-  function Foo() {
+  function __construct() {
   }
 
   function test() {
@@ -23,7 +23,7 @@ echo "ok\n";
 --EXPECT--
 array(2) {
   [0]=>
-  string(3) "Foo"
+  string(11) "__construct"
   [1]=>
   string(4) "test"
 }
index a2372cf8f9cd3a5f40688d6d153e21b8c2a88792..af915e370dd0859b3d53655e28b78b6664e7df96 100644 (file)
@@ -3,7 +3,7 @@ stream filter - reading
 --FILE--
 <?php
 echo "-TEST\n";
-class filter extends php_user_filter {
+class strtoupper_filter extends php_user_filter {
     function filter($in, $out, &$consumed, $closing)
     {
         $output = 0;
@@ -21,7 +21,7 @@ class filter extends php_user_filter {
         return $output ? PSFS_PASS_ON : PSFS_FEED_ME;
     }
 }
-stream_filter_register("strtoupper", "filter")
+stream_filter_register("strtoupper", "strtoupper_filter")
    or die("Failed to register filter");
 
 if ($f = fopen(__FILE__, "rb")) {
@@ -37,7 +37,7 @@ echo "Done\n";
 %sTEST
 <?PHP
 ECHO "-TEST\N";
-CLASS FILTER EXTENDS PHP_USER_FILTER {
+CLASS STRTOUPPER_FILTER EXTENDS PHP_USER_FILTER {
     FUNCTION FILTER($IN, $OUT, &$CONSUMED, $CLOSING)
     {
         $OUTPUT = 0;
@@ -55,7 +55,7 @@ CLASS FILTER EXTENDS PHP_USER_FILTER {
         RETURN $OUTPUT ? PSFS_PASS_ON : PSFS_FEED_ME;
     }
 }
-STREAM_FILTER_REGISTER("STRTOUPPER", "FILTER")
+STREAM_FILTER_REGISTER("STRTOUPPER", "STRTOUPPER_FILTER")
    OR DIE("FAILED TO REGISTER FILTER");
 
 IF ($F = FOPEN(__FILE__, "RB")) {
index efa2dd755061f693f3389bb7f839d6b16eafb731..5ddb3dbbe6d08565ec746c7037c4ecafb6e5a74d 100644 (file)
@@ -6,7 +6,7 @@ Test 11: php:function Support
 <?php
 print "Test 11: php:function Support\n";
   Class foo {
-       function foo() {}
+       function __construct() {}
        function __toString() { return "not a DomNode object";}
   }
 
index 1a1d6fa511d0dd9e4d4fee969730792bf8b2b64f..e6518775ff5fee977f5ad0ea338a91bb0eddf59c 100644 (file)
@@ -18,5 +18,6 @@ $obj = new derived();
 $obj->base();
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; base has a deprecated constructor in %s on line %d
 base::base
 derived::base
index ebfa08081e0f5162be3ef8617e83d306c2065c09..acf20918fdb81c555897e2aa69511938ede4bfbc 100644 (file)
@@ -25,5 +25,6 @@ ReflectionClass::export('Extended');
 
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Extended has a deprecated constructor in %s on line %d
 
 Fatal error: Cannot override final Base::__construct() with Extended::Extended() in %sfinal_ctor1.php on line %d
index 905337b4081ce8d5b94bda51472d73ba93374f95..37fcac29a9338164fe06cfa2f1199253b4b34366 100644 (file)
@@ -25,5 +25,6 @@ ReflectionClass::export('Extended');
 
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Base has a deprecated constructor in %s on line %d
 
 Fatal error: Cannot override final Base::Base() with Extended::__construct() in %sfinal_ctor2.php on line %d
index 3a61ecf902355ca3275e9569031cf622c421b694..b34996c979aaf4ee703967263e4f8aeeecf54c0f 100644 (file)
@@ -10,4 +10,6 @@ Ensure implicit final inherited old-style constructor cannot be overridden.
   }
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
+
 Fatal error: Cannot override final method A::A() in %s on line %d
index 0b8cf2650e92dd215846a28b4ac74fe2ba821163..7669f735e5d33b200d43e5bb03f997eb1d956564 100644 (file)
@@ -17,13 +17,13 @@ class Child_php4 extends Base_php4 {
   }
 }
 
-class Base_php7 {
+class Base_php5 {
   function __construct() {
     var_dump('Base constructor');
   }
   }
 
-class Child_php7 extends Base_php7 {
+class Child_php5 extends Base_php5 {
   function __construct() {
     var_dump('Child constructor');
     parent::__construct();
@@ -37,7 +37,7 @@ class Child_mx1 extends Base_php4 {
   }
 }
 
-class Child_mx2 extends Base_php7 {
+class Child_mx2 extends Base_php5 {
   function Child_mx2() {
     var_dump('Child constructor');
     parent::__construct();
@@ -47,8 +47,8 @@ class Child_mx2 extends Base_php7 {
 echo "### PHP 4 style\n";
 $c4= new Child_php4();
 
-echo "### PHP 7 style\n";
-$c5= new Child_php7();
+echo "### PHP 5 style\n";
+$c5= new Child_php5();
 
 echo "### Mixed style 1\n";
 $cm= new Child_mx1();
@@ -56,11 +56,16 @@ $cm= new Child_mx1();
 echo "### Mixed style 2\n";
 $cm= new Child_mx2();
 ?>
---EXPECT--
+--EXPECTF--
+Deprecated: 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
+
+Deprecated: 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
+
+Deprecated: 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
 ### PHP 4 style
 string(17) "Child constructor"
 string(16) "Base constructor"
-### PHP 7 style
+### PHP 5 style
 string(17) "Child constructor"
 string(16) "Base constructor"
 ### Mixed style 1
index 8990264d9204e4a7e79f92d0a2e516af10ca6ca2..7399bf1168c0cc993b39824473834e3982cbbc2e 100644 (file)
@@ -41,6 +41,7 @@ Check for inherited old-style constructor.
   var_dump(is_callable(array($c, "C")));
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
 About to construct new B: 
 In A::A
 Is B::B() callable?
index 46100449c4107ac221757f5b54f2572cb967a72d..c87fbde3447c59ed1a7632ded6cb12c8eb1b9e5c 100644 (file)
@@ -18,6 +18,7 @@ $b->b();
 
 ?>
 --EXPECTF--
+Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; A has a deprecated constructor in %s on line %d
 array(2) {
   [0]=>
   object(ReflectionMethod)#%d (2) {
index a6ceae7463c4af05703b0752f6d03d54931f1c25..29fd033469292d5db99f8ce63007f9c369072fb7 100644 (file)
@@ -12,7 +12,7 @@ class Class2
 {
        public $storage = '';
 
-       function Class2()
+       function __construct()
        {
                $this->storage = new Class1();