gron                                     Sun, 12 Dec 2010 16:48:02 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=306267

Log:
Changed collision warning for Traits to fatal error.
#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

Changed paths:
    U   php/php-src/trunk/Zend/tests/traits/bugs/case-sensitive.phpt
    U   php/php-src/trunk/Zend/tests/traits/conflict001.phpt
    U   php/php-src/trunk/Zend/tests/traits/conflict003.phpt
    U   php/php-src/trunk/Zend/tests/traits/error_011.phpt
    U   php/php-src/trunk/Zend/tests/traits/error_015.phpt
    U   php/php-src/trunk/Zend/tests/traits/language011.phpt
    U   php/php-src/trunk/Zend/tests/traits/methods_002.phpt
    U   php/php-src/trunk/Zend/zend_compile.c

Modified: php/php-src/trunk/Zend/tests/traits/bugs/case-sensitive.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/bugs/case-sensitive.phpt        
2010-12-12 16:17:50 UTC (rev 306266)
+++ php/php-src/trunk/Zend/tests/traits/bugs/case-sensitive.phpt        
2010-12-12 16:48:02 UTC (rev 306267)
@@ -20,6 +20,4 @@
 }
 ?>
 --EXPECTF--
-Warning: Trait method M1 has not been applied, because there are collisions 
with other trait methods on MyClass in %s on line %d
-
-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

Modified: php/php-src/trunk/Zend/tests/traits/conflict001.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/conflict001.phpt        2010-12-12 
16:17:50 UTC (rev 306266)
+++ php/php-src/trunk/Zend/tests/traits/conflict001.phpt        2010-12-12 
16:48:02 UTC (rev 306267)
@@ -22,4 +22,4 @@
 }
 ?>
 --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

Modified: php/php-src/trunk/Zend/tests/traits/conflict003.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/conflict003.phpt        2010-12-12 
16:17:50 UTC (rev 306266)
+++ php/php-src/trunk/Zend/tests/traits/conflict003.phpt        2010-12-12 
16:48:02 UTC (rev 306267)
@@ -28,6 +28,4 @@

 ?>
 --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

Modified: php/php-src/trunk/Zend/tests/traits/error_011.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/error_011.phpt  2010-12-12 16:17:50 UTC 
(rev 306266)
+++ php/php-src/trunk/Zend/tests/traits/error_011.phpt  2010-12-12 16:48:02 UTC 
(rev 306267)
@@ -23,6 +23,4 @@

 ?>
 --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

Modified: php/php-src/trunk/Zend/tests/traits/error_015.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/error_015.phpt  2010-12-12 16:17:50 UTC 
(rev 306266)
+++ php/php-src/trunk/Zend/tests/traits/error_015.phpt  2010-12-12 16:48:02 UTC 
(rev 306267)
@@ -23,6 +23,4 @@

 ?>
 --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

Modified: php/php-src/trunk/Zend/tests/traits/language011.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/language011.phpt        2010-12-12 
16:17:50 UTC (rev 306266)
+++ php/php-src/trunk/Zend/tests/traits/language011.phpt        2010-12-12 
16:48:02 UTC (rev 306267)
@@ -27,8 +27,4 @@

 ?>
 --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

Modified: php/php-src/trunk/Zend/tests/traits/methods_002.phpt
===================================================================
--- php/php-src/trunk/Zend/tests/traits/methods_002.phpt        2010-12-12 
16:17:50 UTC (rev 306266)
+++ php/php-src/trunk/Zend/tests/traits/methods_002.phpt        2010-12-12 
16:48:02 UTC (rev 306267)
@@ -25,6 +25,4 @@

 ?>
 --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

Modified: php/php-src/trunk/Zend/zend_compile.c
===================================================================
--- php/php-src/trunk/Zend/zend_compile.c       2010-12-12 16:17:50 UTC (rev 
306266)
+++ php/php-src/trunk/Zend/zend_compile.c       2010-12-12 16:48:02 UTC (rev 
306267)
@@ -3459,7 +3459,7 @@

                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);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to