com php-src: Don't enforce LSP if prototype method is private: NEWS Zend/tests/bug72496.phpt Zend/zend_compile.c

From: Date: Tue, 05 Jul 2016 12:30:22 +0000
Subject: com php-src: Don't enforce LSP if prototype method is private: NEWS Zend/tests/bug72496.phpt Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92795@lists.php.net to get a copy of this message
Commit: 08777e9615868cf2acf4dc2a86a7ef21106beddd Author: Pedro Magalhães <pkemo85@gmail.com> Thu, 30 Jun 2016 09:00:33 +0200 Committer: Nikita Popov <nikic@php.net> Tue, 5 Jul 2016 14:30:22 +0200 Parents: 717a043a323b622c79f5d9806493fed272052605 Branches: PHP-5.6 PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=08777e9615868cf2acf4dc2a86a7ef21106beddd Log: Don't enforce LSP if prototype method is private Fixes bug #72496. Bugs: https://bugs.php.net/72496 Changed paths: M NEWS A Zend/tests/bug72496.phpt M Zend/zend_compile.c Diff: diff --git a/NEWS b/NEWS index a884dbb..eda6726 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,8 @@ PHP NEWS - Core: . Fix bug #71936 (Segmentation fault destroying HTTP_RAW_POST_DATA). (mike dot laspina at gmail dot com, Remi) + . Fix bug #72496 (Cannot declare public method with signature incompatible + with parent private method). (Pedro Magalhães) - bz2: . Fix bug #72447 (Type Confusion in php_bz2_filter_create()). (gogil at diff --git a/Zend/tests/bug72496.phpt b/Zend/tests/bug72496.phpt new file mode 100644 index 0000000..62e55cb --- /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 ef152a3..5b67ef8 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; }

« previous php.cvs (#92795) next »