]> 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)
Zend/tests/traits/bug55524.phpt
Zend/zend_compile.c

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;