php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #76869 Incorrect bypassing protected method accessibilty check
Submitted: 2018-09-12 08:48 UTC Modified: 2018-09-12 08:48 UTC
From: dmitry@php.net Assigned: dmitry (profile)
Status: Closed Package: Class/Object related
PHP Version: 7.3.0beta3 OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: dmitry@php.net
New email:
PHP Version: OS:

 

 [2018-09-12 08:48 UTC] 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"

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2018-09-12 08:48 UTC] dmitry@php.net
-Assigned To: +Assigned To: dmitry
 [2018-09-12 09:27 UTC] dmitry@php.net
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).
 [2018-09-12 09:27 UTC] dmitry@php.net
-Status: Assigned +Status: Closed
 [2018-09-12 09:27 UTC] dmitry@php.net
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).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 27 16:01:27 2024 UTC