diff options
author | Xinchen Hui <laruence@php.net> | 2013-02-21 18:18:41 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@php.net> | 2013-02-21 18:18:41 +0800 |
commit | 9a44a9806c7c7a8c1fc691210335d0691a4597be (patch) | |
tree | 0aada5b452de9561043ca07710c8a93d00e31df3 /Zend/tests | |
parent | bae95bd9d4e11e3362926e6fee0638336d9adf62 (diff) | |
download | php-git-9a44a9806c7c7a8c1fc691210335d0691a4597be.tar.gz |
Fixed bug #64235 (Insteadof not work for class method in 5.4.11)
As we discussed with stefan, we think previous of allowing use with
classes is a bug, should be forbided, anyway, the error message should
be improved.
Diffstat (limited to 'Zend/tests')
-rw-r--r-- | Zend/tests/traits/bug64235.phpt | 34 | ||||
-rw-r--r-- | Zend/tests/traits/bug64235b.phpt | 35 | ||||
-rw-r--r-- | Zend/tests/traits/language015.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/traits/language016.phpt | 2 | ||||
-rw-r--r-- | Zend/tests/traits/language017.phpt | 2 |
5 files changed, 72 insertions, 3 deletions
diff --git a/Zend/tests/traits/bug64235.phpt b/Zend/tests/traits/bug64235.phpt new file mode 100644 index 0000000000..d0a2a98a8c --- /dev/null +++ b/Zend/tests/traits/bug64235.phpt @@ -0,0 +1,34 @@ +--TEST-- +Bug #64235 (Insteadof not work for class method in 5.4.11) +--FILE-- +<?php + +class TestParentClass +{ + public function method() + { + print_r('Parent method'); + print "\n"; + } +} + +trait TestTrait +{ + public function method() + { + print_r('Trait method'); + print "\n"; + } +} + +class TestChildClass extends TestParentClass +{ + use TestTrait + { + TestTrait::method as methodAlias; + TestParentClass::method insteadof TestTrait; + } +} +?> +--EXPECTF-- +Fatal error: Class TestParentClass is not a trait, Only traits may be used in 'as' and 'insteadof' statements in %sbug64235.php on line %d diff --git a/Zend/tests/traits/bug64235b.phpt b/Zend/tests/traits/bug64235b.phpt new file mode 100644 index 0000000000..a326ec02c3 --- /dev/null +++ b/Zend/tests/traits/bug64235b.phpt @@ -0,0 +1,35 @@ +--TEST-- +Bug #64235 (Insteadof not work for class method in 5.4.11) +--FILE-- +<?php + +class TestParentClass +{ + public function method() + { + print_r('Parent method'); + print "\n"; + } +} + +trait TestTrait +{ + public function method() + { + print_r('Trait method'); + print "\n"; + } +} + +class TestChildClass extends TestParentClass +{ + use TestTrait + { + TestTrait::method as methodAlias; + TestParentClass::method as TestParent; + } +} + +?> +--EXPECTF-- +Fatal error: Class TestParentClass is not a trait, Only traits may be used in 'as' and 'insteadof' statements in %sbug64235b.php on line %d diff --git a/Zend/tests/traits/language015.phpt b/Zend/tests/traits/language015.phpt index df1f744841..0c9fb4afb2 100644 --- a/Zend/tests/traits/language015.phpt +++ b/Zend/tests/traits/language015.phpt @@ -14,4 +14,4 @@ class C { } } --EXPECTF-- -Fatal error: Trait T2 is not used in %s on line %d +Fatal error: Required Trait T2 wasn't added to C in %slanguage015.php on line %d diff --git a/Zend/tests/traits/language016.phpt b/Zend/tests/traits/language016.phpt index e9281198e5..1c6bbeabac 100644 --- a/Zend/tests/traits/language016.phpt +++ b/Zend/tests/traits/language016.phpt @@ -14,4 +14,4 @@ class C { } } --EXPECTF-- -Fatal error: Trait T2 is not used in %s on line %d +Fatal error: Required Trait T2 wasn't added to C in %slanguage016.php on line %d diff --git a/Zend/tests/traits/language017.phpt b/Zend/tests/traits/language017.phpt index 56f9e2409c..539a05d02f 100644 --- a/Zend/tests/traits/language017.phpt +++ b/Zend/tests/traits/language017.phpt @@ -14,4 +14,4 @@ class C { } } --EXPECTF-- -Fatal error: Trait T2 is not used in %s on line %d +Fatal error: Required Trait T2 wasn't added to C in %slanguage017.php on line %d |