From 6ef9216269c0a42898feed90cec9fc4193cad9b6 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 31 Mar 2015 16:10:06 +0200 Subject: [PATCH] Finish PHP 4 constructor deprecation --- Zend/tests/bug31177-2.phpt | 4 ++-- Zend/tests/bug38942.phpt | 3 ++- Zend/tests/bug39127.phpt | 1 + Zend/tests/bug40784.phpt | 1 + Zend/tests/bug43323.phpt | 2 ++ Zend/tests/bug46381.phpt | 6 ++---- Zend/tests/bug47343.phpt | 2 +- Zend/tests/bug48215_2.phpt | 2 +- Zend/tests/bug50261.phpt | 3 ++- Zend/tests/bug52051.phpt | 9 ++++++++- Zend/tests/bug52160.phpt | 2 +- Zend/tests/dynamic_call_001.phpt | 2 ++ Zend/tests/get_class_methods_001.phpt | 16 ++++++++-------- Zend/tests/get_class_methods_003.phpt | 14 +++++++------- Zend/tests/objects_010.phpt | 3 --- Zend/tests/return_types/023.phpt | 2 ++ Zend/tests/traits/bug55554b.phpt | 2 ++ Zend/tests/traits/noctor001.phpt | 3 ++- Zend/zend_compile.c | 5 +++++ ext/mbstring/tests/common.inc | 2 +- .../mysqli_stmt_bind_result_references.phpt | 2 +- ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt | 4 ++-- ext/reflection/tests/004.phpt | 3 ++- .../ReflectionClass_getConstructor_basic.phpt | 6 +++++- .../ReflectionClass_isInstantiable_error.phpt | 2 ++ ...lectionClass_isInstantiable_variation.phpt | 5 +++++ .../ReflectionClass_newInstanceArgs_001.phpt | 3 ++- .../ReflectionClass_newInstance_001.phpt | 3 ++- .../ReflectionMethod_constructor_basic.phpt | 2 +- ...ReflectionObject_getConstructor_basic.phpt | 6 +++++- ...ReflectionObject_isInstantiable_error.phpt | 2 ++ ...ectionObject_isInstantiable_variation.phpt | 5 +++++ ext/reflection/tests/bug30148.phpt | 3 ++- ext/reflection/tests/bug36434.phpt | 8 ++++---- ext/reflection/tests/bug38942.phpt | 1 + ext/reflection/tests/bug47254.phpt | 5 ++++- ext/reflection/tests/parameters_002.phpt | 13 ++++++++----- ext/session/tests/017.phpt | 2 +- .../interop/Round2/Base/r2_base_015s.phpt | 2 +- .../Round3/GroupE/r3_groupE_list_004w.phpt | 2 +- ext/soap/tests/server006.phpt | 2 +- ext/soap/tests/server008.phpt | 4 ++-- ext/soap/tests/server027.phpt | 4 ++-- ext/standard/tests/filters/read.phpt | 8 ++++---- ext/xsl/tests/xslt011.phpt | 2 +- tests/classes/ctor_name_clash.phpt | 1 + tests/classes/final_ctor1.phpt | 1 + tests/classes/final_ctor2.phpt | 1 + tests/classes/final_ctor3.phpt | 2 ++ tests/classes/inheritance_002.phpt | 19 ++++++++++++------- tests/classes/inheritance_005.phpt | 1 + tests/classes/inheritance_007.phpt | 1 + tests/lang/bug27535.phpt | 2 +- 53 files changed, 138 insertions(+), 73 deletions(-) diff --git a/Zend/tests/bug31177-2.phpt b/Zend/tests/bug31177-2.phpt index 10083c59edc..6cba62cedf1 100644 --- a/Zend/tests/bug31177-2.phpt +++ b/Zend/tests/bug31177-2.phpt @@ -3,13 +3,13 @@ Bug #31177 (memory corruption because of incorrect refcounting) --FILE-- foo(1); + $y=$x->__construct(1); } catch (Exception $e) { var_dump($x); } diff --git a/Zend/tests/bug38942.phpt b/Zend/tests/bug38942.phpt index 85bb56d2001..d0335b1071c 100644 --- a/Zend/tests/bug38942.phpt +++ b/Zend/tests/bug38942.phpt @@ -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 diff --git a/Zend/tests/bug39127.phpt b/Zend/tests/bug39127.phpt index a013da145e5..2f5b0fd2bfe 100644 --- a/Zend/tests/bug39127.phpt +++ b/Zend/tests/bug39127.phpt @@ -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) diff --git a/Zend/tests/bug40784.phpt b/Zend/tests/bug40784.phpt index 6da8f2a16ba..a103d4a01cc 100644 --- a/Zend/tests/bug40784.phpt +++ b/Zend/tests/bug40784.phpt @@ -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 diff --git a/Zend/tests/bug43323.phpt b/Zend/tests/bug43323.phpt index d366a6dd1ff..74abe766e57 100644 --- a/Zend/tests/bug43323.phpt +++ b/Zend/tests/bug43323.phpt @@ -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 diff --git a/Zend/tests/bug46381.phpt b/Zend/tests/bug46381.phpt index 4d58e9fdf31..6479d0c8a40 100644 --- a/Zend/tests/bug46381.phpt +++ b/Zend/tests/bug46381.phpt @@ -1,17 +1,15 @@ --TEST-- Bug #46381 (wrong $this passed to internal methods causes segfault) ---SKIPIF-- - --FILE-- test(); +$test->method(); echo "Done\n"; ?> diff --git a/Zend/tests/bug47343.phpt b/Zend/tests/bug47343.phpt index 07a3b4e3306..b0b7977beb3 100644 --- a/Zend/tests/bug47343.phpt +++ b/Zend/tests/bug47343.phpt @@ -20,7 +20,7 @@ class A class B { - public function B($A) + public function __construct($A) { $this->A = $A; } diff --git a/Zend/tests/bug48215_2.phpt b/Zend/tests/bug48215_2.phpt index 199a252208d..da6b7a84b65 100644 --- a/Zend/tests/bug48215_2.phpt +++ b/Zend/tests/bug48215_2.phpt @@ -8,7 +8,7 @@ class a { } class b extends a {} class c extends b { - function C() { + function __construct() { b::b(); } } diff --git a/Zend/tests/bug50261.phpt b/Zend/tests/bug50261.phpt index 271a2c48059..ce120b9416e 100644 --- a/Zend/tests/bug50261.phpt +++ b/Zend/tests/bug50261.phpt @@ -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) diff --git a/Zend/tests/bug52051.phpt b/Zend/tests/bug52051.phpt index e8a4f49e3ce..acfddbc36d9 100644 --- a/Zend/tests/bug52051.phpt +++ b/Zend/tests/bug52051.phpt @@ -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 diff --git a/Zend/tests/bug52160.phpt b/Zend/tests/bug52160.phpt index c85d2f09afb..a0e5a9d7ae2 100644 --- a/Zend/tests/bug52160.phpt +++ b/Zend/tests/bug52160.phpt @@ -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 diff --git a/Zend/tests/dynamic_call_001.phpt b/Zend/tests/dynamic_call_001.phpt index 94e4203caff..9a22dc2c6b0 100644 --- a/Zend/tests/dynamic_call_001.phpt +++ b/Zend/tests/dynamic_call_001.phpt @@ -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 diff --git a/Zend/tests/get_class_methods_001.phpt b/Zend/tests/get_class_methods_001.phpt index 277ea2cf5ae..a2a3d0ca209 100644 --- a/Zend/tests/get_class_methods_001.phpt +++ b/Zend/tests/get_class_methods_001.phpt @@ -3,30 +3,30 @@ get_class_methods(): Testing scope --FILE-- ---EXPECT-- +--EXPECTF-- array(1) { [0]=> string(1) "a" diff --git a/Zend/tests/get_class_methods_003.phpt b/Zend/tests/get_class_methods_003.phpt index bbb758625b2..5c3c09f4e07 100644 --- a/Zend/tests/get_class_methods_003.phpt +++ b/Zend/tests/get_class_methods_003.phpt @@ -3,13 +3,13 @@ get_class_methods(): Testing scope --FILE-- --EXPECT-- diff --git a/Zend/tests/objects_010.phpt b/Zend/tests/objects_010.phpt index 5d004629d90..0f85498e2c9 100644 --- a/Zend/tests/objects_010.phpt +++ b/Zend/tests/objects_010.phpt @@ -1,7 +1,5 @@ --TEST-- redefining constructor (__construct second) ---INI-- -error_reporting=8191 --FILE-- --EXPECTF-- -Strict Standards: Redefining already defined constructor for class test in %s on line %d Done diff --git a/Zend/tests/return_types/023.phpt b/Zend/tests/return_types/023.phpt index 61a9e1c4e09..9e36bf7c040 100644 --- a/Zend/tests/return_types/023.phpt +++ b/Zend/tests/return_types/023.phpt @@ -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 diff --git a/Zend/tests/traits/bug55554b.phpt b/Zend/tests/traits/bug55554b.phpt index bf40e89a084..06229bac340 100644 --- a/Zend/tests/traits/bug55554b.phpt +++ b/Zend/tests/traits/bug55554b.phpt @@ -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 diff --git a/Zend/tests/traits/noctor001.phpt b/Zend/tests/traits/noctor001.phpt index d15acff87ac..19fe8dbd0d4 100644 --- a/Zend/tests/traits/noctor001.phpt +++ b/Zend/tests/traits/noctor001.phpt @@ -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) diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ad696857b4d..b1dcfcd66bb 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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) { diff --git a/ext/mbstring/tests/common.inc b/ext/mbstring/tests/common.inc index 1df63410773..a40dde03991 100644 --- a/ext/mbstring/tests/common.inc +++ b/ext/mbstring/tests/common.inc @@ -45,7 +45,7 @@ class tc public $s1 = '日本語EUC-JPの文字列'; public $s2 = 'English Text'; - function tc() + function __construct() { } } diff --git a/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt b/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt index c297f8ff673..b8efec5eca9 100644 --- a/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt +++ b/ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt @@ -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; } } diff --git a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt index efcb2e7bcc3..f7f3ce06bce 100644 --- a/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt +++ b/ext/pdo_sqlite/tests/pdo_fetch_func_001.phpt @@ -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) { diff --git a/ext/reflection/tests/004.phpt b/ext/reflection/tests/004.phpt index 2c81c506bea..41632aa3bab 100644 --- a/ext/reflection/tests/004.phpt +++ b/ext/reflection/tests/004.phpt @@ -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=== diff --git a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt index 1f5ba432c3c..c572796ae8d 100644 --- a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt @@ -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 diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_error.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_error.phpt index 52be2391215..52636430238 100644 --- a/ext/reflection/tests/ReflectionClass_isInstantiable_error.phpt +++ b/ext/reflection/tests/ReflectionClass_isInstantiable_error.phpt @@ -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 diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt index 1cf3e613e81..e334a90a728 100644 --- a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt +++ b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt @@ -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) diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt index 981d67519a2..d3a426de4c0 100644 --- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt @@ -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 diff --git a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt index 3cdb5d76b74..afa278a9a19 100644 --- a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt @@ -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 diff --git a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt index 2a2f02ffe05..243c59504be 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt @@ -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) diff --git a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt index 5a0c36f9eec..2fb43562bbf 100644 --- a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt @@ -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 diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_error.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_error.phpt index f993367b2d5..c77c039d4d5 100644 --- a/ext/reflection/tests/ReflectionObject_isInstantiable_error.phpt +++ b/ext/reflection/tests/ReflectionObject_isInstantiable_error.phpt @@ -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 diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt index ac7199c096c..1e5be592993 100644 --- a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt +++ b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt @@ -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) diff --git a/ext/reflection/tests/bug30148.phpt b/ext/reflection/tests/bug30148.phpt index aa5841ee5be..27c31ca6aec 100644 --- a/ext/reflection/tests/bug30148.phpt +++ b/ext/reflection/tests/bug30148.phpt @@ -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) diff --git a/ext/reflection/tests/bug36434.phpt b/ext/reflection/tests/bug36434.phpt index 218055d5467..9598a40b7b1 100644 --- a/ext/reflection/tests/bug36434.phpt +++ b/ext/reflection/tests/bug36434.phpt @@ -4,16 +4,16 @@ Reflection Bug #36434 (Properties from parent class fail to indetify their true ancester; } } class foo extends ancester { -public $bar = "1"; - function foo() + public $bar = "1"; + function __construct() { return $this->bar; } diff --git a/ext/reflection/tests/bug38942.phpt b/ext/reflection/tests/bug38942.phpt index 817190c9970..59666607cb8 100644 --- a/ext/reflection/tests/bug38942.phpt +++ b/ext/reflection/tests/bug38942.phpt @@ -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 [ class bar extends foo ] { @@ %sbug38942.php 6-7 diff --git a/ext/reflection/tests/bug47254.phpt b/ext/reflection/tests/bug47254.phpt index 83593a4ff27..38cdcd62b45 100644 --- a/ext/reflection/tests/bug47254.phpt +++ b/ext/reflection/tests/bug47254.phpt @@ -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 diff --git a/ext/reflection/tests/parameters_002.phpt b/ext/reflection/tests/parameters_002.phpt index a86191042f8..ae924323a0d 100644 --- a/ext/reflection/tests/parameters_002.phpt +++ b/ext/reflection/tests/parameters_002.phpt @@ -3,13 +3,15 @@ ReflectionParameter::getClass(), getDeclaringClass(), getDeclaringFunction() --FILE-- $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) diff --git a/ext/session/tests/017.phpt b/ext/session/tests/017.phpt index dbe53f5698f..baf7df8c574 100644 --- a/ext/session/tests/017.phpt +++ b/ext/session/tests/017.phpt @@ -13,7 +13,7 @@ session.save_handler=files error_reporting(E_ALL); class Kill { - function Kill() { + function __construct() { global $HTTP_SESSION_VARS; session_start(); } diff --git a/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt b/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt index e1052dfa9a7..efbad5a1211 100644 --- a/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt +++ b/ext/soap/tests/interop/Round2/Base/r2_base_015s.phpt @@ -7,7 +7,7 @@ precision=14 --FILE-- varString = $s; $this->varInt = $i; $this->varFloat = $f; diff --git a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt index ade6d8329e5..1c798aaf97f 100644 --- a/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt +++ b/ext/soap/tests/interop/Round3/GroupE/r3_groupE_list_004w.phpt @@ -7,7 +7,7 @@ soap.wsdl_cache_enabled=0 --FILE-- varString = $s; $this->varInt = $i; $this->child = $c; diff --git a/ext/soap/tests/server006.phpt b/ext/soap/tests/server006.phpt index da328ebfeeb..0c94fb29933 100644 --- a/ext/soap/tests/server006.phpt +++ b/ext/soap/tests/server006.phpt @@ -7,7 +7,7 @@ SOAP Server 6: setclass with constructor class Foo { private $str = ""; - function Foo($str) { + function __construct($str) { $this->str = $str . " World"; } diff --git a/ext/soap/tests/server008.phpt b/ext/soap/tests/server008.phpt index 87fb69d25fa..d299a3ae9b0 100644 --- a/ext/soap/tests/server008.phpt +++ b/ext/soap/tests/server008.phpt @@ -6,7 +6,7 @@ SOAP Server 8: setclass and getfunctions - string(3) "Foo" + string(11) "__construct" [1]=> string(4) "test" } diff --git a/ext/soap/tests/server027.phpt b/ext/soap/tests/server027.phpt index 9fee4a6087c..188b94f10ed 100644 --- a/ext/soap/tests/server027.phpt +++ b/ext/soap/tests/server027.phpt @@ -6,7 +6,7 @@ SOAP Server 27: setObject and getFunctions - string(3) "Foo" + string(11) "__construct" [1]=> string(4) "test" } diff --git a/ext/standard/tests/filters/read.phpt b/ext/standard/tests/filters/read.phpt index a2372cf8f9c..af915e370dd 100644 --- a/ext/standard/tests/filters/read.phpt +++ b/ext/standard/tests/filters/read.phpt @@ -3,7 +3,7 @@ stream filter - reading --FILE-- 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 diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt index ebfa08081e0..acf20918fdb 100644 --- a/tests/classes/final_ctor1.phpt +++ b/tests/classes/final_ctor1.phpt @@ -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 diff --git a/tests/classes/final_ctor2.phpt b/tests/classes/final_ctor2.phpt index 905337b4081..37fcac29a93 100644 --- a/tests/classes/final_ctor2.phpt +++ b/tests/classes/final_ctor2.phpt @@ -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 diff --git a/tests/classes/final_ctor3.phpt b/tests/classes/final_ctor3.phpt index 3a61ecf9023..b34996c979a 100644 --- a/tests/classes/final_ctor3.phpt +++ b/tests/classes/final_ctor3.phpt @@ -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 diff --git a/tests/classes/inheritance_002.phpt b/tests/classes/inheritance_002.phpt index 0b8cf2650e9..7669f735e5d 100644 --- a/tests/classes/inheritance_002.phpt +++ b/tests/classes/inheritance_002.phpt @@ -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 diff --git a/tests/classes/inheritance_005.phpt b/tests/classes/inheritance_005.phpt index 8990264d920..7399bf1168c 100644 --- a/tests/classes/inheritance_005.phpt +++ b/tests/classes/inheritance_005.phpt @@ -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? diff --git a/tests/classes/inheritance_007.phpt b/tests/classes/inheritance_007.phpt index 46100449c41..c87fbde3447 100644 --- a/tests/classes/inheritance_007.phpt +++ b/tests/classes/inheritance_007.phpt @@ -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) { diff --git a/tests/lang/bug27535.phpt b/tests/lang/bug27535.phpt index a6ceae7463c..29fd0334692 100644 --- a/tests/lang/bug27535.phpt +++ b/tests/lang/bug27535.phpt @@ -12,7 +12,7 @@ class Class2 { public $storage = ''; - function Class2() + function __construct() { $this->storage = new Class1();