Skip to content

When invoking an inherited method with a ReflectionMethod, get_called_class() mistakenly returns the parent class #1728

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jmarrama opened this issue Feb 7, 2014 · 1 comment

Comments

@jmarrama
Copy link
Contributor

jmarrama commented Feb 7, 2014

class Foo {
  public static function bar() {
    echo get_called_class()."\n";
  }
}
class Baz extends Foo { }

$class = new ReflectionClass('Baz');
$method = $class->getMethod('bar');
$method->invoke(null); // Zend prints 'Baz', HHVM prints 'Foo'

This is likely related to something contained in #1600

@scannell
Copy link
Contributor

scannell commented Feb 7, 2014

Thanks for reporting this. Agree with the assessment on #1600.

thekid added a commit to thekid/behave that referenced this issue Feb 7, 2014
thekid added a commit to thekid/hhvm that referenced this issue Feb 7, 2014
jmarrama added a commit to jmarrama/hhvm that referenced this issue Apr 9, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants