com php-src: Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash): NEWS Zend/tests/bug61761.phpt
Zend/zend_compile.c
| From: | Xinchen Hui | Date: | Wed, 18 Apr 2012 10:13:27 +0000 |
| Subject: | com php-src: Fixed bug #61761 ('Overriding' a private static method with a different signature causes crash): NEWS Zend/tests/bug61761.phpt Zend/zend_compile.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-68810@lists.php.net to get a copy of this message | ||
Commit: da6465a268d9ece2ffd38447890b206dd94b3250
Author: Xinchen Hui <laruence@php.net> Wed, 18 Apr 2012 18:13:27 +0800
Parents: d55afe4df63945a6e3abe9892ba7836f83c74265
Branches: PHP-5.4
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=da6465a268d9ece2ffd38447890b206dd94b3250
Log:
Fixed bug #61761 ('Overriding' a private static method with a different signature causes
crash)
Bugs:
https://bugs.php.net/61761
Changed paths:
M NEWS
A Zend/tests/bug61761.phpt
M Zend/zend_compile.c
Diff:
diff --git a/NEWS b/NEWS
index 2eafb98..1b0278c 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 0000000..631f566
--- /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--
+<?php
+
+class A
+{
+ private static function test($a) { }
+}
+
+class B extends A
+{
+ private static function test($a, $b) { }
+}
+
+?>
+--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 c3c35eb..602b600 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);
}