Skip to content

Commit d8792d8

Browse files
committed
Fixed bug #64988 (Class loading order affects E_STRICT warning)
1 parent 53c39e2 commit d8792d8

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ PHP NEWS
33
?? ??? 2013, PHP 5.4.17
44

55
- Core:
6+
. Fixed bug #64988 (Class loading order affects E_STRICT warning). (Laruence)
67
. Fixed bug #64966 (segfault in zend_do_fcall_common_helper_SPEC). (Laruence)
78
. Fixed bug #64960 (Segfault in gc_zval_possible_root). (Laruence)
89
. Fixed bug #64934 (Apache2 TS crash with get_browser()). (Anatol)

Zend/tests/bug64988.phpt

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
--TEST--
2+
Bug #64988 (Class loading order affects E_STRICT warning)
3+
--FILE--
4+
<?php
5+
abstract class Base1 {
6+
public function insert(array $data){
7+
return array_reverse($data);
8+
}
9+
}
10+
11+
class Noisy1 extends Base1 {
12+
public function insert(array $data, $option1 = Null) {
13+
if (!empty($option1)) {
14+
$data['option1'] = $option1;
15+
}
16+
return parent::insert($data);
17+
}
18+
}
19+
class Smooth1 extends Noisy1 {
20+
public function insert(array $data) {
21+
return parent::insert($data, count($data));
22+
}
23+
}
24+
25+
$o = new Smooth1();
26+
echo "okey";
27+
?>
28+
--EXPECTF--
29+
Strict Standards: Declaration of Smooth1::insert() should be compatible with Noisy1::insert(array $data, $option1 = NULL) in %sbug64988.php on line 20
30+
okey

Zend/zend_compile.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3267,11 +3267,11 @@ static void do_inheritance_check_on_method(zend_function *child, zend_function *
32673267

32683268
if (child->common.prototype && (child->common.prototype->common.fn_flags & ZEND_ACC_ABSTRACT)) {
32693269
if (!zend_do_perform_implementation_check(child, child->common.prototype TSRMLS_CC)) {
3270-
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));
3270+
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));
32713271
}
32723272
} 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 */
32733273
if (!zend_do_perform_implementation_check(child, parent TSRMLS_CC)) {
3274-
char *method_prototype = zend_get_function_declaration(child->common.prototype? child->common.prototype : parent TSRMLS_CC);
3274+
char *method_prototype = zend_get_function_declaration(parent TSRMLS_CC);
32753275
zend_error(E_STRICT, "Declaration of %s::%s() should be compatible with %s", ZEND_FN_SCOPE_NAME(child), child->common.function_name, method_prototype);
32763276
efree(method_prototype);
32773277
}

0 commit comments

Comments
 (0)