com php-src: Fixed bug #64988 (Class loading order affects E_STRICT warning): NEWS Zend/tests/bug6498 8.phpt Zend/zend_compile.c
| From: | Xinchen Hui | Date: | Mon, 10 Jun 2013 13:26:11 +0000 |
| Subject: | com php-src: Fixed bug #64988 (Class loading order affects E_STRICT warning): NEWS Zend/tests/bug6498 8.phpt Zend/zend_compile.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-72354@lists.php.net to get a copy of this message | ||
Commit: d8792d87cf978ef2a977362a7ef8f357820867c2
Author: Xinchen Hui <laruence@php.net> Mon, 10 Jun 2013 21:26:11 +0800
Parents: 53c39e2b4ed32b508763a4db18fd918ab0d036ca
Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d8792d87cf978ef2a977362a7ef8f357820867c2
Log:
Fixed bug #64988 (Class loading order affects E_STRICT warning)
Bugs:
https://bugs.php.net/64988
Changed paths:
M NEWS
A Zend/tests/bug64988.phpt
M Zend/zend_compile.c
Diff:
diff --git a/NEWS b/NEWS
index 60af878..567c81b 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ PHP NEWS
?? ??? 2013, PHP 5.4.17
- Core:
+ . Fixed bug #64988 (Class loading order affects E_STRICT warning). (Laruence)
. Fixed bug #64966 (segfault in zend_do_fcall_common_helper_SPEC). (Laruence)
. Fixed bug #64960 (Segfault in gc_zval_possible_root). (Laruence)
. Fixed bug #64934 (Apache2 TS crash with get_browser()). (Anatol)
diff --git a/Zend/tests/bug64988.phpt b/Zend/tests/bug64988.phpt
new file mode 100644
index 0000000...34fd482
--- /dev/null
+++ b/Zend/tests/bug64988.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #64988 (Class loading order affects E_STRICT warning)
+--FILE--
+<?php
+abstract class Base1 {
+ public function insert(array $data){
+ return array_reverse($data);
+ }
+}
+
+class Noisy1 extends Base1 {
+ public function insert(array $data, $option1 = Null) {
+ if (!empty($option1)) {
+ $data['option1'] = $option1;
+ }
+ return parent::insert($data);
+ }
+}
+class Smooth1 extends Noisy1 {
+ public function insert(array $data) {
+ return parent::insert($data, count($data));
+ }
+}
+
+$o = new Smooth1();
+echo "okey";
+?>
+--EXPECTF--
+Strict Standards: Declaration of Smooth1::insert() should be compatible with Noisy1::insert(array
$data, $option1 = NULL) in %sbug64988.php on line 20
+okey
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 3959517..ab6020c 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -3267,11 +3267,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? child->common.prototype : parent
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));
}
} 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?
child->common.prototype : parent TSRMLS_CC);
+ char *method_prototype = zend_get_function_declaration(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);
}