diff options
author | Pedro Magalhães <pkemo85@gmail.com> | 2016-06-30 09:00:33 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2016-07-05 14:30:22 +0200 |
commit | 08777e9615868cf2acf4dc2a86a7ef21106beddd (patch) | |
tree | 0d27d4c7608c1d1b98f7fd9581b0194d42126bf8 /Zend | |
parent | 717a043a323b622c79f5d9806493fed272052605 (diff) | |
download | php-git-08777e9615868cf2acf4dc2a86a7ef21106beddd.tar.gz |
Don't enforce LSP if prototype method is private
Fixes bug #72496.
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/tests/bug72496.phpt | 43 | ||||
-rw-r--r-- | Zend/zend_compile.c | 4 |
2 files changed, 45 insertions, 2 deletions
diff --git a/Zend/tests/bug72496.phpt b/Zend/tests/bug72496.phpt new file mode 100644 index 0000000000..62e55cb561 --- /dev/null +++ b/Zend/tests/bug72496.phpt @@ -0,0 +1,43 @@ +--TEST-- +Bug #72496 (declare public method with signature incompatible with parent private method should not throw a warning) +--FILE-- +<?php +class Foo +{ + private function getFoo() + { + return 'Foo'; + } + + private function getBar() + { + return 'Bar'; + } + + private function getBaz() + { + return 'Baz'; + } +} + +class Bar extends Foo +{ + public function getFoo($extraArgument) + { + return $extraArgument; + } + + protected function getBar($extraArgument) + { + return $extraArgument; + } + + private function getBaz($extraArgument) + { + return $extraArgument; + } +} + +echo "OK\n"; +--EXPECT-- +OK diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index ef152a38f1..5b67ef8295 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3252,8 +3252,8 @@ 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)) { + /* If the prototype method is private do not enforce a signature */ + if (proto->common.fn_flags & ZEND_ACC_PRIVATE) { return 1; } |