[PHP-CVS] com php-src: Bug #62956: fixing private method signature validation: Zend/tests/bug61761.phpt Zend/tests/bug62956.phpt Zend/zend_compile.c
Commit:6b1073a3a7030d70a684638f098dbf22affb5c63 Author:Lars Strojny lstro...@php.net Tue, 28 Aug 2012 14:06:18 +0200 Parents: dd9478e6c871418a7e130e5f6cacc7eaa8d92cf4 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=6b1073a3a7030d70a684638f098dbf22affb5c63 Log: Bug #62956: fixing private method signature validation In inheritance, if both methods are private, don not enforce the same signature. Bugs: https://bugs.php.net/62956 Changed paths: M Zend/tests/bug61761.phpt A Zend/tests/bug62956.phpt M Zend/zend_compile.c Diff: diff --git a/Zend/tests/bug61761.phpt b/Zend/tests/bug61761.phpt index 631f566..24c69ae 100755 --- a/Zend/tests/bug61761.phpt +++ b/Zend/tests/bug61761.phpt @@ -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== diff --git a/Zend/tests/bug62956.phpt b/Zend/tests/bug62956.phpt new file mode 100644 index 000..c8694d5 --- /dev/null +++ b/Zend/tests/bug62956.phpt @@ -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== diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 704db10..f7b638f 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -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) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] com php-src: Bug #62956: fixing private method signature validation: Zend/tests/bug61761.phpt Zend/tests/bug62956.phpt Zend/zend_compile.c
Commit:f82dd2c77463e01cbcc9912be08f5e45cb1a384c Author:Lars Strojny lstro...@php.net Tue, 28 Aug 2012 14:06:18 +0200 Parents: c11106734d0fbd81ac8332e5a4132d0c6a06 Branches: PHP-5.4 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f82dd2c77463e01cbcc9912be08f5e45cb1a384c Log: Bug #62956: fixing private method signature validation In inheritance, if both methods are private, don not enforce the same signature. Bugs: https://bugs.php.net/62956 Changed paths: M Zend/tests/bug61761.phpt A Zend/tests/bug62956.phpt M Zend/zend_compile.c Diff: diff --git a/Zend/tests/bug61761.phpt b/Zend/tests/bug61761.phpt index 631f566..24c69ae 100755 --- a/Zend/tests/bug61761.phpt +++ b/Zend/tests/bug61761.phpt @@ -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== diff --git a/Zend/tests/bug62956.phpt b/Zend/tests/bug62956.phpt new file mode 100644 index 000..c8694d5 --- /dev/null +++ b/Zend/tests/bug62956.phpt @@ -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== diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 09383c1..bf458e1 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2935,6 +2935,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) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php