-
Notifications
You must be signed in to change notification settings - Fork 3k
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
A function not declared static may be treated as static #3193
Comments
HHVM version should of course be 3.1.0 |
Looking into this. |
A shorter repro: http://3v4l.org/JZWtS |
Just as a note: This is still an issue a year later in HHVM 3.7.0 |
I am going over old issues on this repository, to see which ones apply to the current versions of hhvm. This issue applies to running php code on hhvm. Hhvm nolonger supports running php code since hhvm version 4.0.0. In Hack, this is simply not allowed (anymore).
The typechecker error could be better, because it thinks you might have meant to call |
I was sitting with a problem the entire day and it turned out that I had missed to declare a function as static. When I ran PHP (5.5.9 and 5.5.14) it failed but in HHVM (5.1.0) it gave the same result as I expected if I had written public static function instead of public function.
The error message from PHP was: "PHP Fatal error: Access to undeclared static property: DummyTest\Lib\Database\TPDO::$config in /home/thomas/src/bugtest/staticclass.php on line 50".
It later turned out that the functions
public function Get($name)
public function Set($name, $value)
Should have been declared
public static function Get($name)
public static function Set($name, $value)
However. When I ran the code with errors if passed correctly through HHVM. It even printed "DummyTest\SystemConfig" as a response to get_called_class(). The call went on as if it were declared as static.
The text was updated successfully, but these errors were encountered: