]> granicus.if.org Git - php/commitdiff
Remove support for legacy constructors
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 29 Jan 2019 11:14:54 +0000 (12:14 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Tue, 29 Jan 2019 12:04:20 +0000 (13:04 +0100)
This has been deprecated in PHP 7.0 by
https://wiki.php.net/rfc/remove_php4_constructors.

42 files changed:
UPGRADING
Zend/tests/bug38942.phpt [deleted file]
Zend/tests/bug39127.phpt [deleted file]
Zend/tests/bug40784.phpt [deleted file]
Zend/tests/bug43323.phpt [deleted file]
Zend/tests/bug50261.phpt [deleted file]
Zend/tests/bug52051.phpt [deleted file]
Zend/tests/bug52160.phpt [deleted file]
Zend/tests/dynamic_call_001.phpt [deleted file]
Zend/tests/return_types/023.phpt [deleted file]
Zend/tests/traits/bug55554a.phpt [deleted file]
Zend/tests/traits/bug55554b.phpt [deleted file]
Zend/tests/traits/bug55554c.phpt [deleted file]
Zend/tests/traits/bug55554d.phpt [deleted file]
Zend/tests/traits/bug55554e.phpt [deleted file]
Zend/tests/traits/bug55554f.phpt [deleted file]
Zend/tests/traits/bug55554g.phpt [deleted file]
Zend/tests/traits/noctor001.phpt [deleted file]
Zend/zend_API.c
Zend/zend_compile.c
Zend/zend_inheritance.c
Zend/zend_inheritance.h
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 [deleted file]
ext/reflection/tests/bug38942.phpt [deleted file]
ext/reflection/tests/bug47254.phpt
tests/classes/ctor_name_clash.phpt [deleted file]
tests/classes/final_ctor1.phpt
tests/classes/final_ctor2.phpt [deleted file]
tests/classes/final_ctor3.phpt [deleted file]
tests/classes/inheritance_002.phpt [deleted file]
tests/classes/inheritance_005.phpt [deleted file]
tests/classes/inheritance_007.phpt [deleted file]

index 2087adb715df462e1bc1cba0d6b265eedb5a24e9..9333a94dd790f5abffc8690a6013f27ad970c27a 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -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 (file)
index d0335b1..0000000
+++ /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 (file)
index 31fb6d2..0000000
+++ /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 (file)
index ac2b233..0000000
+++ /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 (file)
index 74abe76..0000000
+++ /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 (file)
index 321e9cf..0000000
+++ /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 (file)
index acfddbc..0000000
+++ /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 (file)
index a0e5a9d..0000000
+++ /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 (file)
index 7f8a6c0..0000000
+++ /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 (file)
index e8e8732..0000000
+++ /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 (file)
index dd844ba..0000000
+++ /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 (file)
index 65ecb7a..0000000
+++ /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 (file)
index 4206892..0000000
+++ /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 (file)
index 88564a8..0000000
+++ /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 (file)
index ed1c324..0000000
+++ /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 (file)
index d7d4fc0..0000000
+++ /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 (file)
index d7de821..0000000
+++ /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 (file)
index 19fe8db..0000000
+++ /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)
index a6aa4e58371f65af2006448cdd677b7da738133c..2ec6d341456b8c89e6ff8a47061b60c644735a04 100644 (file)
@@ -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;
index cfe03e71f94efa704c1befb3f12aac73ffa42c6f..0d7f8b1b25108a148e9547967835057e2c2b60ae 100644 (file)
@@ -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",
index 9dc26088f76bc85c3943452b0070df2be1a65d60..804e16dda621b68fce78ad88678e2a81494969eb 100644 (file)
@@ -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));
-       }
 }
 /* }}} */
 
index a882f6461f069ac0fa21d68294f096723da28977..341edbeab91f141824a1f1226e42e4bb214c80be 100644 (file)
@@ -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()
index 36ae406b43e8b5589a6b400a085d0ebdce002d60..924c3fe2833bd60cce1a0aeac7d4beed816016a0 100644 (file)
@@ -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===
index 5db9d8f3d31b9a330c8502773afc6bc9a72c0360..df6880aedb80fed773fbf864acce99fa7b034664 100644 (file)
@@ -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
index 5263643023838ba82c81ccc007c0e66921bc6d5a..e192e436f04a216ad319ce639538d57b3ffb2d68 100644 (file)
@@ -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
 
index 1378edd3d2f145ac2c8d4208e2710fc4f06c844b..e688b40f466ae719c38c93d0b46f9aa4c82c9f94 100644 (file)
@@ -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)
index 068710311d7afaa13de0b70e100f9ac24591cef0..11bd44077fff7c35b9a65c9aab919571f27181ff 100644 (file)
@@ -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) {
index c91d2ee9584550591451cfb985795e84482fa5e3..bf68098a7d3a2e1bbb1db496dd1888941d00993c 100644 (file)
@@ -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) {
index 243c59504be0dd8e8febbff6a8cbde2b2d51ae64..da108d258d94a06d25f438bff2a68a814de0b426 100644 (file)
@@ -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)
index aecc9b97d267e3a7ad83b09c782eea0043ef703c..fee873fe01770769925dd5b4360e39a6cd0b048d 100644 (file)
@@ -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
index f6d4c9d3d20dc519043666a12e87dfa4041e87a0..f24958421f0ddfa387c4e6a0f1257cc1b4852cc8 100644 (file)
@@ -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
 
index 675bbdde8d884b0fc7d073e0b1232eb0887a0ce7..3baa8a0950dc91e48c55e2040af7110509813023 100644 (file)
@@ -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 (file)
index 27c31ca..0000000
+++ /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 (file)
index 5966660..0000000
+++ /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
-    }
-  }
-}
index e3ce114c9c57795315e9a548eb932abb8448c846..b6f33fcfc645899924effc2768520b9d20097704 100644 (file)
@@ -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 (file)
index e651877..0000000
+++ /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
index acf20918fdb81c555897e2aa69511938ede4bfbc..33fcbe6bd8e2bf0d2edcea67009bd11d80cbfc74 100644 (file)
@@ -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 (file)
index 37fcac2..0000000
+++ /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 (file)
index b34996c..0000000
+++ /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 (file)
index f88c099..0000000
+++ /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 (file)
index 8c5167f..0000000
+++ /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 (file)
index c87fbde..0000000
+++ /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