<?php
error_reporting(E_ALL);
class Base
{
protected function doSomething()
{}
}
class Vendor extends Base
{
protected function doSomething()
{
// do something..
// call parent (Base::doSomething())
parent::doSomething();
// do something more
}
}
class Local extends Vendor
{
protected function doSomething()
{
// do something
// intention: call grand-parent (Base::doSomething())
parent::doSomething(); // this will call Vendor::doSomething() :(
Base::doSomething(); // this would work, without raising a strict error (see https://bugs.php.net/bug.php?id=42016 - not a bug!)
// do something more
}
public function api()
{
$this->doSomething();
}
}
$local = new Local;
$local->api();
Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/C5ZVa on line 7
Process exited with code 255.
Parse error: parse error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /in/C5ZVa on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /in/C5ZVa on line 7
Process exited with code 255.