gron Sun, 04 Mar 2012 18:33:33 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=323892
Log: Fixed Bug #60911 (Confusing error message when extending traits) Bug: https://bugs.php.net/60911 (Assigned) Confusing error message when extending traits Changed paths: U php/php-src/branches/PHP_5_4/NEWS U php/php-src/branches/PHP_5_4/Zend/tests/traits/bug55524.phpt U php/php-src/branches/PHP_5_4/Zend/zend_compile.c U php/php-src/trunk/Zend/tests/traits/bug55524.phpt U php/php-src/trunk/Zend/zend_compile.c Modified: php/php-src/branches/PHP_5_4/NEWS =================================================================== --- php/php-src/branches/PHP_5_4/NEWS 2012-03-04 18:26:11 UTC (rev 323891) +++ php/php-src/branches/PHP_5_4/NEWS 2012-03-04 18:33:33 UTC (rev 323892) @@ -17,6 +17,7 @@ . 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) Modified: php/php-src/branches/PHP_5_4/Zend/tests/traits/bug55524.phpt =================================================================== --- php/php-src/branches/PHP_5_4/Zend/tests/traits/bug55524.phpt 2012-03-04 18:26:11 UTC (rev 323891) +++ php/php-src/branches/PHP_5_4/Zend/tests/traits/bug55524.phpt 2012-03-04 18:33:33 UTC (rev 323892) @@ -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 Modified: php/php-src/branches/PHP_5_4/Zend/zend_compile.c =================================================================== --- php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2012-03-04 18:26:11 UTC (rev 323891) +++ php/php-src/branches/PHP_5_4/Zend/zend_compile.c 2012-03-04 18:33:33 UTC (rev 323892) @@ -4995,7 +4995,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; Modified: php/php-src/trunk/Zend/tests/traits/bug55524.phpt =================================================================== --- php/php-src/trunk/Zend/tests/traits/bug55524.phpt 2012-03-04 18:26:11 UTC (rev 323891) +++ php/php-src/trunk/Zend/tests/traits/bug55524.phpt 2012-03-04 18:33:33 UTC (rev 323892) @@ -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 Modified: php/php-src/trunk/Zend/zend_compile.c =================================================================== --- php/php-src/trunk/Zend/zend_compile.c 2012-03-04 18:26:11 UTC (rev 323891) +++ php/php-src/trunk/Zend/zend_compile.c 2012-03-04 18:33:33 UTC (rev 323892) @@ -4995,7 +4995,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;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php