Bug #76869 [Asn->Csd]: Incorrect bypassing protected method accessibilty check
| From: | dmitry@php.net | Date: | Wed, 12 Sep 2018 09:27:25 +0000 |
| Subject: | Bug #76869 [Asn->Csd]: Incorrect bypassing protected method accessibilty check | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-217011@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76869&edit=1
ID: 76869
Updated by: dmitry@php.net
Reported by: dmitry@php.net
Summary: Incorrect bypassing protected method accessibilty
check
-Status: Assigned
+Status: Closed
Type: Bug
Package: Class/Object related
Operating System: *
PHP Version: 7.3.0beta3
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of dmitry@zend.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=655a99d1312b3dfd72a1b9e59b7b9322203f615b
Log: Fixed bug #76869 (Incorrect bypassing protected method accessibilty check).
Previous Comments:
------------------------------------------------------------------------
[2018-09-12 08:48:04] dmitry@php.net
Description:
------------
In case protected method overrides a private one. PHP may bypass protected method accessibility
check.
Test script:
---------------
<?php
class A {
private function f() {
return "A";
}
}
class B extends A {
protected function f() {
return "B";
}
}
$b = new B();
try {
var_dump($b->f());
} catch (Throwable $e) {
echo "Exception: ", $e->getMessage(), "\n";
}
?>
Expected result:
----------------
Exception: Call to protected method B::f() from context ''
Actual result:
--------------
string(1) "B"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76869&edit=1