]> granicus.if.org Git - php/commitdiff
Fixed Bug #60911 (Confusing error message when extending traits)
authorStefan Marr <gron@php.net>
Sun, 4 Mar 2012 18:33:33 +0000 (18:33 +0000)
committerStefan Marr <gron@php.net>
Sun, 4 Mar 2012 18:33:33 +0000 (18:33 +0000)
NEWS
Zend/tests/traits/bug55524.phpt
Zend/zend_compile.c

diff --git a/NEWS b/NEWS
index 2151b8e61defe9707933329ffb225f2e25ebf53d..1be7ccf16c6de351faba9ead74e4e05c70ea9a50 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,7 @@ PHP                                                                        NEWS
   . Fixed bug #60717 (Order of traits in use statement can cause a fatal
     error). (Stefan)
   . Fixed bug #60801 (strpbrk() mishandles NUL byte). (Adam)
+  . Fixed bug #60911 (Confusing error message when extending traits). (Stefan)
   . Fixed bug #60978 (exit code incorrect). (Laruence)
   . Fixed bug #61000 (Exceeding max nesting level doesn't delete numerical 
     vars). (Laruence)
index 1911cde130599af9656c90fb52ba77bf0ca4533a..137975980dd70dc22be9badafc1b423d03f08174 100644 (file)
@@ -12,4 +12,4 @@ trait Foo extends Base {
 echo 'DONE';
 ?>
 --EXPECTF--
-Fatal error: A trait (Foo) cannot extend a class in %s on line %d
+Fatal error: A trait (Foo) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error in %s on line %d
index a7b130d8fdb0315e3d3a3490bb00b4bf5b3b94db..88c5020a29f866b4aaa036af91f7c622e73a4858 100644 (file)
@@ -4995,7 +4995,7 @@ void zend_do_begin_class_declaration(const znode *class_token, znode *class_name
        if (doing_inheritance) {
        /* Make sure a trait does not try to extend a class */
        if ((new_class_entry->ce_flags & ZEND_ACC_TRAIT) == ZEND_ACC_TRAIT) {
-           zend_error(E_COMPILE_ERROR, "A trait (%s) cannot extend a class", new_class_entry->name);
+           zend_error(E_COMPILE_ERROR, "A trait (%s) cannot extend a class. Traits can only be composed from other traits with the 'use' keyword. Error", new_class_entry->name);
        }
     
                opline->extended_value = parent_class_name->u.op.var;