From: Xinchen Hui Date: Wed, 18 Apr 2012 10:13:27 +0000 (+0800) Subject: Fixed bug #61761 ('Overriding' a private static method with a different signature... X-Git-Tag: php-5.4.4RC1~107^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da6465a268d9ece2ffd38447890b206dd94b3250;p=php Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash) --- diff --git a/NEWS b/NEWS index 2eafb98f70..1b0278cf8f 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,10 @@ PHP NEWS $_SERVER['SCRIPT_FILENAME'] when using router). (Laruence) . "Connection: close" instead of "Connection: closed" (Gustavo) +- Core: + . Fixed bug #61761 ('Overriding' a private static method with a different + signature causes crash). (Laruence) + - JSON . Fixed bug #61537 (json_encode() incorrectly truncates/discards information). (Adam) @@ -17,7 +21,8 @@ PHP NEWS (merge after 5.3.11 release) - Core: - . Fixed bug #61728 (PHP crash when calling ob_start in request_shutdown phase). (Laruence) + . Fixed bug #61728 (PHP crash when calling ob_start in request_shutdown + phase). (Laruence) . Fixed bug #61660 (bin2hex(hex2bin($data)) != $data). (Nikita Popov) . Fixed bug #61650 (ini parser crashes when using ${xxxx} ini variables (without apache2)). (Laruence) diff --git a/Zend/tests/bug61761.phpt b/Zend/tests/bug61761.phpt new file mode 100755 index 0000000000..631f566eaa --- /dev/null +++ b/Zend/tests/bug61761.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #61761 ('Overriding' a private static method with a different signature causes crash) +--FILE-- + +--EXPECTF-- +Strict Standards: Declaration of B::test() should be compatible with A::test($a) in %sbug61761.php on line %d diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index c3c35eb5fc..602b600410 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3260,11 +3260,11 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function * if (child->common.prototype && (child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) { if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) { - zend_error(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_get_function_declaration(child->common.prototype TSRMLS_CC)); + zend_error(E_COMPILE_ERROR, "Declaration of %s::%s() must be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, zend_get_function_declaration(child->common.prototype? child->common.prototype : parent TSRMLS_CC)); } } else if (EG(error_reporting) & E_STRICT || EG(user_error_handler)) { /* Check E_STRICT (or custom error handler) before the check so that we save some time */ if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) { - char *method_prototype = zend_get_function_declaration(child->common.prototype TSRMLS_CC); + char *method_prototype = zend_get_function_declaration(child->common.prototype? child->common.prototype : parent TSRMLS_CC); zend_error(E_STRICT, "Declaration of %s::%s() should be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, method_prototype); efree(method_prototype); }