I\'ve found something that appears to be a strange inheritance issue in PHP.
From the PHP manual:
Members declared protected can be accessed only
There is no rationale about this, it has been reported 2 years ago: https://bugs.php.net/bug.php?id=52120
You can access those methods because there is a declaration of them as protected in Foo
, which is your parent and that gives you permission to access it. If you remove the declaration from the parent and declare the protected method in B
you will get a Fatal Error.
This is reported as a bug in PHP https://bugs.php.net/bug.php?id=50892