Edit report at https://bugs.php.net/bug.php?id=60174&edit=1
ID: 60174 Updated by: larue...@php.net Reported by: simon at simon dot geek dot nz Summary: Notice when array in method prototype error -Status: Analyzed +Status: Closed Type: Bug Package: *General Issues PHP Version: 5.4SVN-2011-10-30 (SVN) Assigned To: laruence Block user comment: N Private report: N New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2011-10-31 03:47:06] larue...@php.net Automatic comment from SVN on behalf of laruence Revision: http://svn.php.net/viewvc/?view=revision&revision=318599 Log: Fixed bug #60174 (Notice when array in method prototype error) this should also exists in ext/reflection. since the new warning of "array to string convert" is introduced in zend_make_printable_zval which is used in ext/reflection too ------------------------------------------------------------------------ [2011-10-30 09:24:27] simon at simon dot geek dot nz Description: ------------ If a class redefines a method of a superclass and does not match the method signature and the original signature contains an array, a notice about array to string conversion is also raised. The notice is raised on either the first line of the subclass (class blah extends blah) or on the line containing the closing } for the class. This seems to be caused by: zend_error(E_STRICT, "Declaration of %s::%s() should be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, method_prototype); in Zend/zend_compile.c (line 3232 as at revision 318576). If the notice is an expected result, I would expect it to occur on the line of the function prototype rather than the class opening or closing line, though I do not expect that notice at all as it appears to be more of PHP bug rather than an implementation problem. The notice also appears if the error reporting level does not contain E_STRICT but a custom error handler is loaded. If there's no custom error handler and the reporting level does not contain E_STRICT, then the E_NOTICE is not displayed. Test script: --------------- <?php class A { public static function test($arg = array()) { } } class B extends A { public static function test() { } } Expected result: ---------------- Strict Standards: Declaration of B::test() should be compatible with A::test($arg = Array) in /Users/simon/Sites/test.php on line 11 Actual result: -------------- Notice: Array to string conversion in /Users/simon/Sites/test.php on line 11 Strict Standards: Declaration of B::test() should be compatible with A::test($arg = Array) in /Users/simon/Sites/test.php on line 11 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60174&edit=1