diff options
42 files changed, 36 insertions, 1151 deletions
| @@ -21,6 +21,8 @@ PHP 8.0 UPGRADE NOTES  ========================================  - Core: +  . Methods with the same name as the class are no longer interpreted as +    constructors. The __construct() method should be used instead.    . Removed (unset) cast.    . Removed track_errors ini directive. This means that $php_errormsg is no      longer available. The error_get_last() function may be used instead. diff --git a/Zend/tests/bug38942.phpt b/Zend/tests/bug38942.phpt deleted file mode 100644 index d0335b1071..0000000000 --- a/Zend/tests/bug38942.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Bug #38942 (Double old-style-ctor inheritance) ---FILE-- -<?php -class foo { -    public function foo() {} -} - -class bar extends foo { -} -print_r(get_class_methods("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 -Array -( -    [0] => foo -) diff --git a/Zend/tests/bug39127.phpt b/Zend/tests/bug39127.phpt deleted file mode 100644 index 31fb6d27d5..0000000000 --- a/Zend/tests/bug39127.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Bug #39127 (Old-style constructor fallbacks produce strange results) ---FILE-- -<?php - -class a { function a() { var_dump("a::a() called"); } } -class b extends a {} - -$b = new b; -var_dump(is_callable(array($b,"a"))); -var_dump(is_callable(array($b,"b"))); -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) -bool(false) -Done diff --git a/Zend/tests/bug40784.phpt b/Zend/tests/bug40784.phpt deleted file mode 100644 index ac2b2331b2..0000000000 --- a/Zend/tests/bug40784.phpt +++ /dev/null @@ -1,25 +0,0 @@ ---TEST-- -Bug #40784 (Case sensivity in constructor's fallback) ---FILE-- -<?php - -class A { -	  function A () { echo "I'm A\n"; } -} - -class B extends A { -  function __construct() { -    parent::__construct(); -    parent::__constrUct(); -  } -} - -$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 deleted file mode 100644 index 74abe766e5..0000000000 --- a/Zend/tests/bug43323.phpt +++ /dev/null @@ -1,14 +0,0 @@ ---TEST-- -Bug #43323 (Wrong count abstract methods) ---FILE-- -<?php -abstract class bar { -    abstract public function 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/bug50261.phpt b/Zend/tests/bug50261.phpt deleted file mode 100644 index 321e9cfb8b..0000000000 --- a/Zend/tests/bug50261.phpt +++ /dev/null @@ -1,39 +0,0 @@ ---TEST-- -Bug #50261 (Crash When Calling Parent Constructor with call_user_func()) ---FILE-- -<?php - -class testClass { -	function testClass($x) { -		echo __METHOD__, " (". $x . ")\n"; -	} -} - -class testClass2 extends testClass { -	function __construct() { -		static $x = 0; - -		if ($x) { -			print "Infinite loop...\n"; -		} else { -			$x++; - -			parent::__construct(1); -			testclass::__construct(2); -			call_user_func(array('parent', '__construct'), 3); -			call_user_func(array('testclass', '__construct'), 4); -			call_user_func(array('testclass', 'testclass'), 5); -		} -	} -} - -new testClass2; - -?> ---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) -testClass::testClass (4) -testClass::testClass (5) diff --git a/Zend/tests/bug52051.phpt b/Zend/tests/bug52051.phpt deleted file mode 100644 index acfddbc36d..0000000000 --- a/Zend/tests/bug52051.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Bug #52051 (handling of case sensitivity of old-style constructors changed in 5.3+) ---FILE-- -<?php - -class AA { -    function AA() { echo "foo\n"; } -} -class bb extends AA {} -class CC extends bb { -   function CC() { parent::bb(); } -} -new CC(); - -class A { -    function A() { echo "bar\n"; } -} -class B extends A {} -class C extends B { -   function C() { parent::B(); } -} -new C(); - -?> ---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 deleted file mode 100644 index a0e5a9d7ae..0000000000 --- a/Zend/tests/bug52160.phpt +++ /dev/null @@ -1,34 +0,0 @@ ---TEST-- -Bug #52160 (Invalid E_STRICT redefined constructor error) ---FILE-- -<?php - -class bar { -	function __construct() { } -	static function bar() { -		var_dump(1); -	} -} - -bar::bar(); - -class foo { -	static function foo() { -		var_dump(2); -	} -	function __construct() { } -} - -foo::foo(); - -class baz { -	static function baz() { -		var_dump(3); -	} -} - -?> ---EXPECTF-- -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 deleted file mode 100644 index 7f8a6c0b3d..0000000000 --- a/Zend/tests/dynamic_call_001.phpt +++ /dev/null @@ -1,22 +0,0 @@ ---TEST-- -Testing dynamic call to constructor (old-style) ---FILE-- -<?php - -class foo { -	public function foo() { -	} -} - -$a = 'foo'; - -$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: Uncaught Error: Non-static method foo::foo() cannot be called statically in %s:%d -Stack trace: -#0 {main} -  thrown in %s on line %d diff --git a/Zend/tests/return_types/023.phpt b/Zend/tests/return_types/023.phpt deleted file mode 100644 index e8e8732ef1..0000000000 --- a/Zend/tests/return_types/023.phpt +++ /dev/null @@ -1,12 +0,0 @@ ---TEST-- -PHP 4 Constructors cannot declare a return type ---FILE-- -<?php - -class Foo { -	function foo() : 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 %d diff --git a/Zend/tests/traits/bug55554a.phpt b/Zend/tests/traits/bug55554a.phpt deleted file mode 100644 index dd844ba661..0000000000 --- a/Zend/tests/traits/bug55554a.phpt +++ /dev/null @@ -1,33 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// All constructors should be registered as such - -trait TConstructor { -    public function constructor() { -        echo "ctor executed\n"; -    } -} - -class NewConstructor { -	use TConstructor { -	    constructor as __construct; -	} -} - -class LegacyConstructor { -    use TConstructor { -        constructor as LegacyConstructor; -    } -} - -echo "New constructor: "; -$o = new NewConstructor; - -echo "Legacy constructor: "; -$o = new LegacyConstructor; ---EXPECT-- -New constructor: ctor executed -Legacy constructor: ctor executed diff --git a/Zend/tests/traits/bug55554b.phpt b/Zend/tests/traits/bug55554b.phpt deleted file mode 100644 index 65ecb7adaf..0000000000 --- a/Zend/tests/traits/bug55554b.phpt +++ /dev/null @@ -1,55 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -trait TConstructor { -    public function foo() { -        echo "foo executed\n"; -    } -    public function bar() { -        echo "bar executed\n"; -    } -} - -class OverridingIsSilent1 { -    use TConstructor { -	    foo as __construct; -	} - -	public function __construct() { -	    echo "OverridingIsSilent1 __construct\n"; -	} -} - -$o = new OverridingIsSilent1; - -class OverridingIsSilent2 { -    use TConstructor { -	    foo as OverridingIsSilent2; -	} - -	public function OverridingIsSilent2() { -	    echo "OverridingIsSilent2 OverridingIsSilent2\n"; -	} -} - -$o = new OverridingIsSilent2; - -class ReportCollision { -	use TConstructor { -	    bar as ReportCollision; -	    foo as __construct; -	} -} - - -echo "ReportCollision: "; -$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/bug55554c.phpt b/Zend/tests/traits/bug55554c.phpt deleted file mode 100644 index 420689259e..0000000000 --- a/Zend/tests/traits/bug55554c.phpt +++ /dev/null @@ -1,44 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// Test that the behavior is consistent with the existing handling of new -// and legacy constructors. -// Here, the traits conflicts are overridden by local definitions, -// and the two constructor definitions do not directly collide in that case. - -trait TC1 { -    public function __construct() { -        echo "TC1 executed\n"; -    } -    public function ReportCollision() { -        echo "TC1 executed\n"; -    } -} - -trait TC2 { -    public function __construct() { -        echo "TC2 executed\n"; -    } -    public function ReportCollision() { -        echo "TC1 executed\n"; -    } -} - -class ReportCollision { -	use TC1, TC2; - -	public function __construct() { -        echo "New constructor executed\n"; -    } -    public function ReportCollision() { -        echo "Legacy constructor executed\n"; -    } -} - - -echo "ReportCollision: "; -$o = new ReportCollision; ---EXPECT-- -ReportCollision: New constructor executed diff --git a/Zend/tests/traits/bug55554d.phpt b/Zend/tests/traits/bug55554d.phpt deleted file mode 100644 index 88564a83c1..0000000000 --- a/Zend/tests/traits/bug55554d.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// Test mixed constructors from different traits, we are more strict about -// these cases, since that can lead to un-expected behavior. -// It is not consistent with the normal constructor handling, but -// here we have a chance to be more strict for the new traits. - -trait TNew { -    public function __construct() { -        echo "TNew executed\n"; -    } -} - -trait TLegacy { -    public function ReportCollision() { -        echo "ReportCollision executed\n"; -    } -} - -class ReportCollision { -    use TNew, TLegacy; -} - -$o = new ReportCollision; ---EXPECTF-- -Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d diff --git a/Zend/tests/traits/bug55554e.phpt b/Zend/tests/traits/bug55554e.phpt deleted file mode 100644 index ed1c324831..0000000000 --- a/Zend/tests/traits/bug55554e.phpt +++ /dev/null @@ -1,28 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// Ensuring that the collision still occurs as expected. - -trait TC1 { -    public function ReportCollision() { -        echo "TC1 executed\n"; -    } -} - -trait TC2 { -    public function ReportCollision() { -        echo "TC1 executed\n"; -    } -} - -class ReportCollision { -	use TC1, TC2; -} - - -echo "ReportCollision: "; -$o = new ReportCollision; ---EXPECTF-- -Fatal error: Trait method ReportCollision has not been applied, because there are collisions with other trait methods on ReportCollision in %s on line %d diff --git a/Zend/tests/traits/bug55554f.phpt b/Zend/tests/traits/bug55554f.phpt deleted file mode 100644 index d7d4fc007d..0000000000 --- a/Zend/tests/traits/bug55554f.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// Ensuring that inconsistent constructor use results in an error to avoid -// problems creeping in. - -trait TNew { -    public function __construct() { -        echo "TNew executed\n"; -    } -} - -class ReportCollision { -    use TNew; - -	public function ReportCollision() { -	    echo "ReportCollision executed\n"; -	} -} - - -echo "ReportCollision: "; -$o = new ReportCollision; ---EXPECTF-- -Fatal error: ReportCollision has colliding constructor definitions coming from traits in %s on line %d diff --git a/Zend/tests/traits/bug55554g.phpt b/Zend/tests/traits/bug55554g.phpt deleted file mode 100644 index d7de8216b0..0000000000 --- a/Zend/tests/traits/bug55554g.phpt +++ /dev/null @@ -1,27 +0,0 @@ ---TEST-- -Bug #55137 (Legacy constructor not registered for class) ---FILE-- -<?php - -// Ensuring that inconsistent constructor use results in an error to avoid -// problems creeping in. - -trait TLegacy { -    public function ReportCollision() { -        echo "TLegacy executed\n"; -    } -} - -class ReportCollision { -    use TLegacy; - -	public function __construct() { -	    echo "ReportCollision executed\n"; -	} -} - - -echo "ReportCollision: "; -$o = new ReportCollision; ---EXPECTF-- -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 deleted file mode 100644 index 19fe8dbd0d..0000000000 --- a/Zend/tests/traits/noctor001.phpt +++ /dev/null @@ -1,29 +0,0 @@ ---TEST-- -Don't mark trait methods as constructor ---FILE-- -<?php -trait Foo { -    public function Foo() { -    } -} - -class Bar { -    use Foo; -    public function Bar() { -    } -} - -$rfoofoo = new ReflectionMethod('Foo::Foo'); -var_dump($rfoofoo->isConstructor()); - -$rbarfoo = new ReflectionMethod('Bar::Foo'); -var_dump($rbarfoo->isConstructor()); - -$rbarbar = new ReflectionMethod('Bar::Bar'); -var_dump($rbarbar->isConstructor()); -?> ---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_API.c b/Zend/zend_API.c index a6aa4e5837..2ec6d34145 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -2262,13 +2262,8 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio  		}  		if (scope) { -			/* Look for ctor, dtor, clone -			 * If it's an old-style constructor, store it only if we don't have -			 * a constructor already. -			 */ -			if ((fname_len == class_name_len) && !ctor && !memcmp(ZSTR_VAL(lowercase_name), lc_class_name, class_name_len+1)) { -				ctor = reg_function; -			} else if (ZSTR_VAL(lowercase_name)[0] != '_' || ZSTR_VAL(lowercase_name)[1] != '_') { +			/* Look for ctor, dtor, clone */ +			if (ZSTR_VAL(lowercase_name)[0] != '_' || ZSTR_VAL(lowercase_name)[1] != '_') {  				reg_function = NULL;  			} else if (zend_string_equals_literal(lowercase_name, ZEND_CONSTRUCTOR_FUNC_NAME)) {  				ctor = reg_function; diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index cfe03e71f9..0d7f8b1b25 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -5539,7 +5539,6 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo  {  	zend_class_entry *ce = CG(active_class_entry);  	zend_bool in_interface = (ce->ce_flags & ZEND_ACC_INTERFACE) != 0; -	zend_bool in_trait = (ce->ce_flags & ZEND_ACC_TRAIT) != 0;  	zend_bool is_public = (op_array->fn_flags & ZEND_ACC_PUBLIC) != 0;  	zend_bool is_static = (op_array->fn_flags & ZEND_ACC_STATIC) != 0; @@ -5631,11 +5630,7 @@ void zend_begin_method_decl(zend_op_array *op_array, zend_string *name, zend_boo  			}  		}  	} else { -		if (!in_trait && zend_string_equals_ci(lcname, ce->name)) { -			if (!ce->constructor) { -				ce->constructor = (zend_function *) op_array; -			} -		} else if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') { +		if (ZSTR_VAL(lcname)[0] != '_' || ZSTR_VAL(lcname)[1] != '_') {  			if (!is_static) {  				op_array->fn_flags |= ZEND_ACC_ALLOW_STATIC;  			} @@ -6253,11 +6248,6 @@ void zend_compile_class_decl(zend_ast *ast, zend_bool toplevel) /* {{{ */  	/* Reset lineno for final opcodes and errors */  	CG(zend_lineno) = ast->lineno; -	if (!(ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS)) { -		/* For traits this check is delayed until after trait binding */ -		zend_check_deprecated_constructor(ce); -	} -  	if (ce->constructor) {  		if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) {  			zend_error_noreturn(E_COMPILE_ERROR, "Constructor %s::%s() cannot be static", diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index 9dc26088f7..804e16dda6 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1287,14 +1287,11 @@ static void zend_do_implement_interfaces(zend_class_entry *ce) /* {{{ */  static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zend_function* fe) /* {{{ */  { -	if (ZSTR_LEN(ce->name) != ZSTR_LEN(mname) && (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '_')) { +	if (ZSTR_VAL(mname)[0] != '_' || ZSTR_VAL(mname)[1] != '_') {  		/* pass */  	} else if (zend_string_equals_literal(mname, ZEND_CLONE_FUNC_NAME)) {  		ce->clone = fe;  	} else if (zend_string_equals_literal(mname, ZEND_CONSTRUCTOR_FUNC_NAME)) { -		if (ce->constructor && (!ce->parent || ce->constructor != ce->parent->constructor)) { -			zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name)); -		}  		ce->constructor = fe;  	} else if (zend_string_equals_literal(mname, ZEND_DESTRUCTOR_FUNC_NAME)) {  		ce->destructor = fe; @@ -1318,16 +1315,6 @@ static void zend_add_magic_methods(zend_class_entry* ce, zend_string* mname, zen  		ce->__tostring = fe;  	} else if (zend_string_equals_literal(mname, ZEND_DEBUGINFO_FUNC_NAME)) {  		ce->__debugInfo = fe; -	} else if (ZSTR_LEN(ce->name) == ZSTR_LEN(mname)) { -		zend_string *lowercase_name = zend_string_tolower(ce->name); -		lowercase_name = zend_new_interned_string(lowercase_name); -		if (!memcmp(ZSTR_VAL(mname), ZSTR_VAL(lowercase_name), ZSTR_LEN(mname))) { -			if (ce->constructor  && (!ce->parent || ce->constructor != ce->parent->constructor)) { -				zend_error_noreturn(E_COMPILE_ERROR, "%s has colliding constructor definitions coming from traits", ZSTR_VAL(ce->name)); -			} -			ce->constructor = fe; -		} -		zend_string_release_ex(lowercase_name, 0);  	}  }  /* }}} */ @@ -1934,32 +1921,6 @@ static void zend_do_bind_traits(zend_class_entry *ce) /* {{{ */  	zend_do_traits_property_binding(ce, traits);  	efree(traits); - -	/* Emit E_DEPRECATED for PHP 4 constructors */ -	zend_check_deprecated_constructor(ce); -} -/* }}} */ - - -static zend_bool zend_has_deprecated_constructor(const zend_class_entry *ce) /* {{{ */ -{ -	const zend_string *constructor_name; -	if (!ce->constructor) { -		return 0; -	} -	constructor_name = ce->constructor->common.function_name; -	return !zend_binary_strcasecmp( -		ZSTR_VAL(ce->name), ZSTR_LEN(ce->name), -		ZSTR_VAL(constructor_name), ZSTR_LEN(constructor_name) -	); -} -/* }}} */ - -void zend_check_deprecated_constructor(const zend_class_entry *ce) /* {{{ */ -{ -	if (zend_has_deprecated_constructor(ce)) { -		zend_error(E_DEPRECATED, "Methods with the same name as their class will not be constructors in a future version of PHP; %s has a deprecated constructor", ZSTR_VAL(ce->name)); -	}  }  /* }}} */ diff --git a/Zend/zend_inheritance.h b/Zend/zend_inheritance.h index a882f6461f..341edbeab9 100644 --- a/Zend/zend_inheritance.h +++ b/Zend/zend_inheritance.h @@ -30,7 +30,6 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent  ZEND_API void zend_do_link_class(zend_class_entry *ce, zend_class_entry *parent_ce);  void zend_verify_abstract_class(zend_class_entry *ce); -void zend_check_deprecated_constructor(const zend_class_entry *ce);  void zend_build_properties_info_table(zend_class_entry *ce);  END_EXTERN_C() diff --git a/ext/reflection/tests/004.phpt b/ext/reflection/tests/004.phpt index 36ae406b43..924c3fe283 100644 --- a/ext/reflection/tests/004.phpt +++ b/ext/reflection/tests/004.phpt @@ -4,7 +4,7 @@ ReflectionMethod::invoke() with non object or null value  <?php  class a { -	function a(){ +	function __construct(){  	}  }  class b { @@ -13,7 +13,7 @@ class b {  $b = new b();  $a=new ReflectionClass("a"); -$m=$a->getMethod("a"); +$m=$a->getMethod("__construct");  try {          $m->invoke(null); @@ -35,9 +35,7 @@ try {          echo $E->getMessage()."\n";  } -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 -Trying to invoke non static method a::a() without an object +?> +--EXPECT-- +Trying to invoke non static method a::__construct() without an object  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 5db9d8f3d3..df6880aedb 100644 --- a/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt +++ b/ext/reflection/tests/ReflectionClass_getConstructor_basic.phpt @@ -9,48 +9,7 @@ class NewCtor {  class ExtendsNewCtor extends NewCtor {  } -class OldCtor { -	function OldCtor() {} -} - -class ExtendsOldCtor extends OldCtor { -} - - -class X { -	function Y() {} -} - -class Y extends X { -} - -class OldAndNewCtor { -	function OldAndNewCtor() {} -	function __construct() {} -} - -class NewAndOldCtor { -	function __construct() {} -	function NewAndOldCtor() {} -} -class B { -	function B() {} -} - -class C extends B { -	function C() {} -} - -class D1 extends C { -	function __construct() {} -} - -class D2 extends C { -} - -$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor', -				 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y'); - +$classes = array('NewCtor', 'ExtendsNewCtor');  foreach ($classes as $class) {  	$rc = new ReflectionClass($class);  	$rm = $rc->getConstructor(); @@ -63,21 +22,6 @@ foreach ($classes as $class) {  }  ?> ---EXPECTF-- -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 +--EXPECT--  Constructor of NewCtor: __construct  Constructor of ExtendsNewCtor: __construct -Constructor of OldCtor: OldCtor -Constructor of ExtendsOldCtor: OldCtor -Constructor of OldAndNewCtor: __construct -Constructor of NewAndOldCtor: __construct -Constructor of B: B -Constructor of C: C -Constructor of D1: __construct -Constructor of D2: C -No constructor for X -No constructor for Y diff --git a/ext/reflection/tests/ReflectionClass_isInstantiable_error.phpt b/ext/reflection/tests/ReflectionClass_isInstantiable_error.phpt index 5263643023..e192e436f0 100644 --- a/ext/reflection/tests/ReflectionClass_isInstantiable_error.phpt +++ b/ext/reflection/tests/ReflectionClass_isInstantiable_error.phpt @@ -2,18 +2,16 @@  ReflectionClass::IsInstantiable()  --FILE--  <?php -class privateCtorOld { -	private function privateCtorOld() {} +class privateCtorNew { +	private function __construct() {}  } -$reflectionClass = new ReflectionClass("privateCtorOld"); +$reflectionClass = new ReflectionClass("privateCtorNew");  var_dump($reflectionClass->IsInstantiable('X'));  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 1378edd3d2..e688b40f46 100644 --- a/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt +++ b/ext/reflection/tests/ReflectionClass_isInstantiable_variation.phpt @@ -17,39 +17,16 @@ class privateCtorNew {  	private function __construct() {}  } -class publicCtorOld { -	public function publicCtorOld() {} -} - -class protectedCtorOld { -	protected function protectedCtorOld() {} -} - -class privateCtorOld { -	private function privateCtorOld() {} -} - - -$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew", -				 	"publicCtorOld", "protectedCtorOld", "privateCtorOld"); - -foreach($classes  as $class ) { +$classes = array("noCtor", "publicCtorNew", "protectedCtorNew", "privateCtorNew"); +foreach ($classes as $class) {  	$reflectionClass = new ReflectionClass($class);  	echo "Is $class instantiable?  ";  	var_dump($reflectionClass->IsInstantiable());  }  ?> ---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 +--EXPECT--  Is noCtor instantiable?  bool(true)  Is publicCtorNew instantiable?  bool(true)  Is protectedCtorNew instantiable?  bool(false)  Is privateCtorNew instantiable?  bool(false) -Is publicCtorOld instantiable?  bool(true) -Is protectedCtorOld instantiable?  bool(false) -Is privateCtorOld instantiable?  bool(false) diff --git a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt index 068710311d..11bd44077f 100644 --- a/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstanceArgs_001.phpt @@ -5,11 +5,6 @@ Robin Fernandes <robinf@php.net>  Steve Seear <stevseea@php.net>  --FILE--  <?php -class A { -	public function A() { -		echo "In constructor of class A\n"; -	} -}  class B {  	public function __construct($a, $b) { @@ -32,28 +27,17 @@ class E {  } -$rcA = new ReflectionClass('A');  $rcB = new ReflectionClass('B');  $rcC = new ReflectionClass('C');  $rcD = new ReflectionClass('D');  $rcE = new ReflectionClass('E');  try { -	var_dump($rcA->newInstanceArgs()); -} catch (Throwable $e) { -	echo "Exception: " . $e->getMessage() . "\n"; -} -try { -	var_dump($rcA->newInstanceArgs(array('x'))); -} catch (Throwable $e) { -	echo "Exception: " . $e->getMessage() . "\n"; -} - -try {  	var_dump($rcB->newInstanceArgs());  } catch (Throwable $e) {  	echo "Exception: " . $e->getMessage() . "\n";  } +  try {  	var_dump($rcB->newInstanceArgs(array('x', 123)));  } catch (Throwable $e) { @@ -85,13 +69,6 @@ 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 -object(A)#%d (0) { -} -In constructor of class A -object(A)#%d (0) { -}  Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected  In constructor of class B with args x, 123  object(B)#%d (0) { diff --git a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt index c91d2ee958..bf68098a7d 100644 --- a/ext/reflection/tests/ReflectionClass_newInstance_001.phpt +++ b/ext/reflection/tests/ReflectionClass_newInstance_001.phpt @@ -5,11 +5,6 @@ Robin Fernandes <robinf@php.net>  Steve Seear <stevseea@php.net>  --FILE--  <?php -class A { -	public function A() { -		echo "In constructor of class A\n"; -	} -}  class B {  	public function __construct($a, $b) { @@ -28,20 +23,15 @@ class D {  		echo "In constructor of class D\n";  	}  } +  class E {  } - -$rcA = new ReflectionClass('A');  $rcB = new ReflectionClass('B');  $rcC = new ReflectionClass('C');  $rcD = new ReflectionClass('D');  $rcE = new ReflectionClass('E'); -$a1 = $rcA->newInstance(); -$a2 = $rcA->newInstance('x'); -var_dump($a1, $a2); -  try {  	var_dump($rcB->newInstance());  } catch (Throwable $e) { @@ -78,13 +68,6 @@ 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) { -} -object(A)#%d (0) { -}  Exception: Too few arguments to function B::__construct(), 0 passed and exactly 2 expected  In constructor of class B with args x, 123  object(B)#%d (0) { diff --git a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt index 243c59504b..da108d258d 100644 --- a/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt +++ b/ext/reflection/tests/ReflectionMethod_constructor_basic.phpt @@ -19,21 +19,6 @@ echo "\nInherited new-style constructor\n";  $methodInfo = new ReflectionMethod("ExtendsNewCtor::__construct");  var_dump($methodInfo->isConstructor()); -class OldCtor { -    function OldCtor() { -        echo "In " . __METHOD__ . "\n"; -    } -} -echo "\nOld-style constructor:\n"; -$methodInfo = new ReflectionMethod("OldCtor::OldCtor"); -var_dump($methodInfo->isConstructor()); - -class ExtendsOldCtor extends OldCtor { -} -echo "\nInherited old-style constructor:\n"; -$methodInfo = new ReflectionMethod("ExtendsOldCtor::OldCtor"); -var_dump($methodInfo->isConstructor()); -  class X {      function Y() {          echo "In " . __METHOD__ . "\n"; @@ -49,69 +34,16 @@ echo "\nInherited method of the same name as the class:\n";  $methodInfo = new ReflectionMethod("Y::Y");  var_dump($methodInfo->isConstructor()); -class OldAndNewCtor { -    function OldAndNewCtor() { -        echo "In " . __METHOD__ . "\n"; -    } - -    function __construct() { -        echo "In " . __METHOD__ . "\n"; -    } -} -echo "\nOld-style constructor:\n"; -$methodInfo = new ReflectionMethod("OldAndNewCtor::OldAndNewCtor"); -var_dump($methodInfo->isConstructor()); - -echo "\nRedefined constructor:\n"; -$methodInfo = new ReflectionMethod("OldAndNewCtor::__construct"); -var_dump($methodInfo->isConstructor()); - -class NewAndOldCtor { -    function __construct() { -        echo "In " . __METHOD__ . "\n"; -    } - -    function NewAndOldCtor() { -        echo "In " . __METHOD__ . "\n"; -    } -} -echo "\nNew-style constructor:\n"; -$methodInfo = new ReflectionMethod("NewAndOldCtor::__construct"); -var_dump($methodInfo->isConstructor()); - -echo "\nRedefined old-style constructor:\n"; -$methodInfo = new ReflectionMethod("NewAndOldCtor::NewAndOldCtor"); -var_dump($methodInfo->isConstructor()); -  ?> ---EXPECTF-- -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 +--EXPECT--  New-style constructor:  bool(true)  Inherited new-style constructor  bool(true) -Old-style constructor: -bool(true) - -Inherited old-style constructor: -bool(true) -  Not a constructor:  bool(false)  Inherited method of the same name as the class:  bool(false) - -Old-style constructor: -bool(false) - -Redefined constructor: -bool(true) - -New-style constructor: -bool(true) - -Redefined old-style constructor: -bool(false) diff --git a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt index aecc9b97d2..fee873fe01 100644 --- a/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt +++ b/ext/reflection/tests/ReflectionObject_getConstructor_basic.phpt @@ -9,14 +9,6 @@ class NewCtor {  class ExtendsNewCtor extends NewCtor {  } -class OldCtor { -	function OldCtor() {} -} - -class ExtendsOldCtor extends OldCtor { -} - -  class X {  	function Y() {}  } @@ -24,15 +16,6 @@ class X {  class Y extends X {  } -class OldAndNewCtor { -	function OldAndNewCtor() {} -	function __construct() {} -} - -class NewAndOldCtor { -	function __construct() {} -	function NewAndOldCtor() {} -}  class B {  	function B() {}  } @@ -48,8 +31,8 @@ class D1 extends C {  class D2 extends C {  } -$classes = array('NewCtor', 'ExtendsNewCtor', 'OldCtor', 'ExtendsOldCtor', -				 'OldAndNewCtor', 'NewAndOldCtor', 'B', 'C', 'D1', 'D2', 'X', 'Y'); +$classes = array('NewCtor', 'ExtendsNewCtor', +				 'B', 'C', 'D1', 'D2', 'X', 'Y');  foreach ($classes as $class) {  	$rc = new ReflectionObject(new $class); @@ -63,21 +46,12 @@ foreach ($classes as $class) {  }  ?> ---EXPECTF-- -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 +--EXPECT--  Constructor of NewCtor: __construct  Constructor of ExtendsNewCtor: __construct -Constructor of OldCtor: OldCtor -Constructor of ExtendsOldCtor: OldCtor -Constructor of OldAndNewCtor: __construct -Constructor of NewAndOldCtor: __construct -Constructor of B: B -Constructor of C: C +No constructor for B +No constructor for C  Constructor of D1: __construct -Constructor of D2: C +No constructor for D2  No constructor for X  No constructor for Y diff --git a/ext/reflection/tests/ReflectionObject_isInstantiable_error.phpt b/ext/reflection/tests/ReflectionObject_isInstantiable_error.phpt index f6d4c9d3d2..f24958421f 100644 --- a/ext/reflection/tests/ReflectionObject_isInstantiable_error.phpt +++ b/ext/reflection/tests/ReflectionObject_isInstantiable_error.phpt @@ -2,21 +2,19 @@  ReflectionObject::IsInstantiable() - invalid params  --FILE--  <?php -class privateCtorOld { -	private function privateCtorOld() {} +class privateCtornew { +	private function __construct() {}  	public static function reflectionObjectFactory() {  		return new ReflectionObject(new self);  	}  } -$reflectionObject =  privateCtorOld::reflectionObjectFactory(); +$reflectionObject = privateCtorNew::reflectionObjectFactory();  var_dump($reflectionObject->IsInstantiable('X'));  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 675bbdde8d..3baa8a0950 100644 --- a/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt +++ b/ext/reflection/tests/ReflectionObject_isInstantiable_variation.phpt @@ -30,54 +30,21 @@ class privateCtorNew {  	}  } -class publicCtorOld { -	public function publicCtorOld() {} -	public static function reflectionObjectFactory() { -		return new ReflectionObject(new self); -	} -} - -class protectedCtorOld { -	protected function protectedCtorOld() {} -	public static function reflectionObjectFactory() { -		return new ReflectionObject(new self); -	} -} - -class privateCtorOld { -	private function privateCtorOld() {} -	public static function reflectionObjectFactory() { -		return new ReflectionObject(new self); -	} -} - -  $reflectionObjects = array(  		noCtor::reflectionObjectFactory(),  		publicCtorNew::reflectionObjectFactory(),  		protectedCtorNew::reflectionObjectFactory(),  		privateCtorNew::reflectionObjectFactory(), -		publicCtorOld::reflectionObjectFactory(), -		protectedCtorOld::reflectionObjectFactory(), -		privateCtorOld::reflectionObjectFactory()  	); -foreach($reflectionObjects  as $reflectionObject ) { +foreach ($reflectionObjects as $reflectionObject) {  	$name = $reflectionObject->getName();  	echo "Is $name instantiable? ";  	var_dump($reflectionObject->IsInstantiable());  }  ?> ---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 +--EXPECT--  Is noCtor instantiable? bool(true)  Is publicCtorNew instantiable? bool(true)  Is protectedCtorNew instantiable? bool(false)  Is privateCtorNew instantiable? bool(false) -Is publicCtorOld instantiable? bool(true) -Is protectedCtorOld instantiable? bool(false) -Is privateCtorOld instantiable? bool(false) diff --git a/ext/reflection/tests/bug30148.phpt b/ext/reflection/tests/bug30148.phpt deleted file mode 100644 index 27c31ca6ae..0000000000 --- a/ext/reflection/tests/bug30148.phpt +++ /dev/null @@ -1,36 +0,0 @@ ---TEST-- -Reflection Bug #30148 (ReflectionMethod->isConstructor() fails for inherited classes) ---FILE-- -<?php - -class Root -{ -	function Root() {} -} -class Base extends Root -{ -	function __construct() {} -} -class Derived extends Base -{ -} -$a = new ReflectionMethod('Root','Root'); -$b = new ReflectionMethod('Base','Root'); -$c = new ReflectionMethod('Base','__construct'); -$d = new ReflectionMethod('Derived','Root'); -$e = new ReflectionMethod('Derived','__construct'); -var_dump($a->isConstructor()); -var_dump($b->isConstructor()); -var_dump($c->isConstructor()); -var_dump($d->isConstructor()); -var_dump($e->isConstructor()); -?> -===DONE=== ---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) -bool(false) -bool(true) -===DONE=== diff --git a/ext/reflection/tests/bug38942.phpt b/ext/reflection/tests/bug38942.phpt deleted file mode 100644 index 59666607cb..0000000000 --- a/ext/reflection/tests/bug38942.phpt +++ /dev/null @@ -1,35 +0,0 @@ ---TEST-- -Bug #38942 (Double old-style-ctor inheritance) ---FILE-- -<?php -class foo { -    public function foo() {} -} - -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 - -  - Constants [0] { -  } - -  - Static properties [0] { -  } - -  - Static methods [0] { -  } - -  - Properties [0] { -  } - -  - Methods [1] { -    Method [ <user, inherits foo, ctor> public method foo ] { -      @@ %sbug38942.php 3 - 3 -    } -  } -} diff --git a/ext/reflection/tests/bug47254.phpt b/ext/reflection/tests/bug47254.phpt index e3ce114c9c..b6f33fcfc6 100644 --- a/ext/reflection/tests/bug47254.phpt +++ b/ext/reflection/tests/bug47254.phpt @@ -23,10 +23,7 @@ $m = $R->getMethods();  print_r($m);  ?> ---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 +--EXPECT--  Array  (      [0] => ReflectionMethod Object diff --git a/tests/classes/ctor_name_clash.phpt b/tests/classes/ctor_name_clash.phpt deleted file mode 100644 index e6518775ff..0000000000 --- a/tests/classes/ctor_name_clash.phpt +++ /dev/null @@ -1,23 +0,0 @@ ---TEST-- -ZE2 The child class can re-use the parent class name for a function member ---FILE-- -<?php -class base { -  function base() { -    echo __CLASS__."::".__FUNCTION__."\n"; -  } -} - -class derived extends base { -  function base() { -    echo __CLASS__."::".__FUNCTION__."\n"; -  } -} - -$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 diff --git a/tests/classes/final_ctor1.phpt b/tests/classes/final_ctor1.phpt index acf20918fd..33fcbe6bd8 100644 --- a/tests/classes/final_ctor1.phpt +++ b/tests/classes/final_ctor1.phpt @@ -16,15 +16,11 @@ class Works extends Base  class Extended extends Base  { -	public function Extended() +	public function __construct()  	{  	}  } -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 +Fatal error: Cannot override final method Base::__construct() in %s on line %d diff --git a/tests/classes/final_ctor2.phpt b/tests/classes/final_ctor2.phpt deleted file mode 100644 index 37fcac29a9..0000000000 --- a/tests/classes/final_ctor2.phpt +++ /dev/null @@ -1,30 +0,0 @@ ---TEST-- -ZE2 cannot override final old style ctor ---FILE-- -<?php - -class Base -{ -	public final function Base() -	{ -	} -} - -class Works extends Base -{ -} - -class Extended extends Base -{ -	public function __construct() -	{ -	} -} - -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 deleted file mode 100644 index b34996c979..0000000000 --- a/tests/classes/final_ctor3.phpt +++ /dev/null @@ -1,15 +0,0 @@ ---TEST-- -Ensure implicit final inherited old-style constructor cannot be overridden. ---FILE-- -<?php -  class A { -      final function A() { } -  } -  class B extends A { -      function A() { } -  } -?> ---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 deleted file mode 100644 index f88c0996bd..0000000000 --- a/tests/classes/inheritance_002.phpt +++ /dev/null @@ -1,74 +0,0 @@ ---TEST-- -ZE2 Constructor precedence ---FILE-- -<?php -class Base_php4 { -  function Base_php4() { -    var_dump('Base constructor'); -  } -} - -class Child_php4 extends Base_php4 { -  function Child_php4() { -    var_dump('Child constructor'); -    parent::Base_php4(); -  } -} - -class Base_php5 { -  function __construct() { -    var_dump('Base constructor'); -  } -  } - -class Child_php5 extends Base_php5 { -  function __construct() { -    var_dump('Child constructor'); -    parent::__construct(); -  } -  } - -class Child_mx1 extends Base_php4 { -  function __construct() { -    var_dump('Child constructor'); -    parent::Base_php4(); -  } -} - -class Child_mx2 extends Base_php5 { -  function Child_mx2() { -    var_dump('Child constructor'); -    parent::__construct(); -  } -} - -echo "### PHP 4 style\n"; -$c4= new Child_php4(); - -echo "### PHP 5 style\n"; -$c5= new Child_php5(); - -echo "### Mixed style 1\n"; -$cm= new Child_mx1(); - -echo "### Mixed style 2\n"; -$cm= new Child_mx2(); -?> ---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 5 style -string(17) "Child constructor" -string(16) "Base constructor" -### Mixed style 1 -string(17) "Child constructor" -string(16) "Base constructor" -### Mixed style 2 -string(17) "Child constructor" -string(16) "Base constructor" diff --git a/tests/classes/inheritance_005.phpt b/tests/classes/inheritance_005.phpt deleted file mode 100644 index 8c5167f4bf..0000000000 --- a/tests/classes/inheritance_005.phpt +++ /dev/null @@ -1,58 +0,0 @@ ---TEST-- -Check for inherited old-style constructor. ---FILE-- -<?php -  class A -  { -      function A() -      { -          echo "In " . __METHOD__ . "\n"; -      } -  } - -  class B extends A -  { -  } - -  class C extends B -  { -  } - - -  echo "About to construct new B: \n"; -  $b = new B; - -  echo "Is B::B() callable?\n"; -  var_dump(is_callable(array($b, "B"))); - -  echo "Is B::A() callable?\n"; -  var_dump(is_callable(array($b, "A"))); - -  echo "About to construct new C: \n"; -  $c = new C; - -  echo "Is C::A() callable?\n"; -  var_dump(is_callable(array($c, "A"))); - -  echo "Is C::B() callable?\n"; -  var_dump(is_callable(array($c, "B"))); - -  echo "Is C::C() callable?\n"; -  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? -bool(false) -Is B::A() callable? -bool(true) -About to construct new C:  -In A::A -Is C::A() callable? -bool(true) -Is C::B() callable? -bool(false) -Is C::C() callable? -bool(false) diff --git a/tests/classes/inheritance_007.phpt b/tests/classes/inheritance_007.phpt deleted file mode 100644 index c87fbde344..0000000000 --- a/tests/classes/inheritance_007.phpt +++ /dev/null @@ -1,40 +0,0 @@ ---TEST-- -Ensure inherited old-style constructor doesn't block other methods ---FILE-- -<?php -class A { -  public function B () { echo "In " . __METHOD__ . "\n"; } -  public function A () { echo "In " . __METHOD__ . "\n"; } -} -class B extends A { } - -$rc = new ReflectionClass('B'); -var_dump($rc->getMethods()); - - -$b = new B(); -$b->a(); -$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) { -    ["name"]=> -    string(1) "B" -    ["class"]=> -    string(1) "A" -  } -  [1]=> -  object(ReflectionMethod)#%d (2) { -    ["name"]=> -    string(1) "A" -    ["class"]=> -    string(1) "A" -  } -} -In A::A -In A::A -In A::B | 
