php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77039 about `protected` keywords
Submitted: 2018-10-19 07:56 UTC Modified: 2021-02-01 13:21 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: 200847041 at qq dot com Assigned: cmb (profile)
Status: Duplicate Package: Scripting Engine problem
PHP Version: 7.2.11 OS: Ubuntu16
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: 200847041 at qq dot com
New email:
PHP Version: OS:

 

 [2018-10-19 07:56 UTC] 200847041 at qq dot com
Description:
------------
Derived classes of the same base class can access each other's protected method and protected property.

Test script:
---------------
class Base {
protected function foo() {
   echo 'foo';
}
}

class A extends Base {

}

class B extends Base {

public function bar() {
  $a = new A();
  // in fact, it is ok, and will echo foo.
  // but I think it should not access
  $a->foo();
}

}

(new B())->bar();


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-01 13:21 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Package: Doc Build problem +Package: Scripting Engine problem -Assigned To: +Assigned To: cmb
 [2021-02-01 13:21 UTC] cmb@php.net
Closing as duplicate of bug #50892.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 05:01:33 2024 UTC