mirror of
https://github.com/php/php-src.git
synced 2024-11-24 10:24:11 +08:00
Bug #62956: fixing private method signature validation
In inheritance, if both methods are private, don not enforce the same signature.
This commit is contained in:
parent
dd9478e6c8
commit
6b1073a3a7
@ -14,5 +14,6 @@ class B extends A
|
||||
}
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECTF--
|
||||
Strict Standards: Declaration of B::test() should be compatible with A::test($a) in %sbug61761.php on line %d
|
||||
==DONE==
|
||||
|
20
Zend/tests/bug62956.phpt
Normal file
20
Zend/tests/bug62956.phpt
Normal file
@ -0,0 +1,20 @@
|
||||
--TEST--
|
||||
Bug #62956: "incompatible" signatures for private methods should not cause E_STRICT
|
||||
--FILE--
|
||||
<?php
|
||||
class Base
|
||||
{
|
||||
private function test()
|
||||
{}
|
||||
}
|
||||
|
||||
class Extension extends Base
|
||||
{
|
||||
private function test($arg)
|
||||
{}
|
||||
}
|
||||
|
||||
?>
|
||||
==DONE==
|
||||
--EXPECT--
|
||||
==DONE==
|
@ -2969,6 +2969,11 @@ static zend_bool zend_do_perform_implementation_check(const zend_function *fe, c
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* If both methods are private do not enforce a signature */
|
||||
if ((fe->common.fn_flags & ZEND_ACC_PRIVATE) && (proto->common.fn_flags & ZEND_ACC_PRIVATE)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* check number of arguments */
|
||||
if (proto->common.required_num_args < fe->common.required_num_args
|
||||
|| proto->common.num_args > fe->common.num_args) {
|
||||
|
Loading…
Reference in New Issue
Block a user