php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch extend-error-msg.patch for *General Issues Bug #60911

Patch version 2012-01-31 10:01 UTC

Return to Bug #60911 | Download this patch
Patch Revisions:

Developer: gron@php.net

Index: Zend/zend_compile.c
===================================================================
--- Zend/zend_compile.c	(revision 322946)
+++ Zend/zend_compile.c	(working copy)
@@ -4985,7 +4989,7 @@
 	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;
Index: Zend/tests/traits/bug55524.phpt
===================================================================
--- Zend/tests/traits/bug55524.phpt	(revision 322946)
+++ Zend/tests/traits/bug55524.phpt	(working copy)
@@ -12,4 +12,4 @@
 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
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 10:02:06 2014 UTC