]> granicus.if.org Git - php/commitdiff
Changed collision warning for Traits to fatal error.
authorStefan Marr <gron@php.net>
Sun, 12 Dec 2010 16:48:02 +0000 (16:48 +0000)
committerStefan Marr <gron@php.net>
Sun, 12 Dec 2010 16:48:02 +0000 (16:48 +0000)
#This change is made to have all possible cases of collisions consistently handled as fatal errors.
#The reason to have it fatal is that most likely something changed unexpectedly and needs urgent attention by the developer, since it will fail eventually anyway for instance because the expected method is missing in the class.
#Discussed in this thread: http://marc.info/?l=php-internals&m=129155790226876

Zend/tests/traits/bugs/case-sensitive.phpt
Zend/tests/traits/conflict001.phpt
Zend/tests/traits/conflict003.phpt
Zend/tests/traits/error_011.phpt
Zend/tests/traits/error_015.phpt
Zend/tests/traits/language011.phpt
Zend/tests/traits/methods_002.phpt
Zend/zend_compile.c

index 1d7b77a0c4a87035f296fc3fa3ab41741b1546c1..13d4188f2f441e1664178eb024f7e850c9547a68 100644 (file)
@@ -20,6 +20,4 @@ class MyClass {
 }\r
 ?>\r
 --EXPECTF--\r
-Warning: Trait method M1 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d\r
-\r
-Warning: Trait method M2 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
\ No newline at end of file
+Fatal error: Trait method M1 has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d\r
index a129b63dae39f15288c3a69f1b24dc47c1fdcdb0..32346b3d9237d0f4f8df2b1c8cbf9c63592f5c8a 100644 (file)
@@ -22,4 +22,4 @@ class TraitsTest {
 }
 ?>
 --EXPECTF--    
-Warning: Trait method hello has not been applied, because there are collisions with other trait methods on TraitsTest in %s on line %d
\ No newline at end of file
+Fatal error: Trait method hello has not been applied, because there are collisions with other trait methods on TraitsTest in %s on line %d
\ No newline at end of file
index 5a6d9cf9155ee3650f05dec55ccb1a66ca56ec00..0e71063f19da0c067e747db73df012790d91b2bd 100644 (file)
@@ -28,6 +28,4 @@ class Talker {
 
 ?>
 --EXPECTF--    
-Warning: Trait method smallTalk has not been applied, because there are collisions with other trait methods on Talker in %s on line %d
-
-Warning: Trait method bigTalk has not been applied, because there are collisions with other trait methods on Talker in %s on line %d
\ No newline at end of file
+Fatal error: Trait method smallTalk has not been applied, because there are collisions with other trait methods on Talker in %s on line %d
\ No newline at end of file
index a6372a43d4073e7b4a2de5590191e4cddaad722a..2d266dd1ec16a6da605c95796380bc8c42c985fc 100644 (file)
@@ -23,6 +23,4 @@ var_dump($x->test());
 
 ?>
 --EXPECTF--
-Warning: Trait method test has not been applied, because there are collisions with other trait methods on bar in %s on line %d
-
-Fatal error: Call to undefined method bar::test() in %s on line %d
+Fatal error: Trait method test has not been applied, because there are collisions with other trait methods on bar in %s on line %d
index ec47c0d8e25782b175f78be4b078c9dcad063b8d..efcffea5f3a0f95f73aa2745cd7ec1ed0463da64 100644 (file)
@@ -23,6 +23,4 @@ var_dump($x->test());
 
 ?>
 --EXPECTF--
-Warning: Trait method test has not been applied, because there are collisions with other trait methods on bar in %s on line %d
-
-Fatal error: Call to undefined method bar::test() in %s on line %d
+Fatal error: Trait method test has not been applied, because there are collisions with other trait methods on bar in %s on line %d
index 8c4b1a489a0ae8652a6349bdd62e99d1a2386e09..cf535b4c115ee741118ec0077f3e5677e0ccec62 100644 (file)
@@ -27,8 +27,4 @@ $o->sayWorld();
 
 ?>
 --EXPECTF--    
-Warning: Trait method sayWorld has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
-
-Warning: Trait method sayHello has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
-
-Fatal error: Call to undefined method MyClass::sayHello() in %s on line %d
\ No newline at end of file
+Fatal error: Trait method sayWorld has not been applied, because there are collisions with other trait methods on MyClass in %s on line %d
index 58fbf93fb9e2999a1f0369c0a829fc2dd0b4baff..4ed64c1a55a64e2799a40ea93f5be5c0327affc0 100644 (file)
@@ -25,6 +25,4 @@ var_dump(clone $o);
 
 ?>
 --EXPECTF--
-Warning: Trait method __clone has not been applied, because there are collisions with other trait methods on bar in %s on line %d
-object(bar)#%d (0) {
-}
+Fatal error: Trait method __clone has not been applied, because there are collisions with other trait methods on bar in %s on line %d
index ac31da4157a42cf1b9dd765ef1204c27e4c45caa..5a18514d23a12b8272c8487fcf5fe9f2f503c2b7 100644 (file)
@@ -3459,7 +3459,7 @@ static int zend_traits_merge_functions(zend_function *fn TSRMLS_DC, int num_args
 
                if (zend_hash_quick_find(&ce->function_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void **)&class_fn) == FAILURE
                        || class_fn->common.scope != ce) {
-                               zend_error(E_WARNING, "Trait method %s has not been applied, because there are collisions with other trait methods on %s", fn->common.function_name, ce->name);
+                               zend_error(E_ERROR, "Trait method %s has not been applied, because there are collisions with other trait methods on %s", fn->common.function_name, ce->name);
                }
 
                zend_function_dtor(fn);