-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
get_class_vars contains a break change #13835
Comments
Documentation says: "Returns an associative array of declared properties visible from the current scope, with their default value". So, I suppose this was a bug fixed in 8.1. |
well I don't think so, if you check the link above, it is working since 7.4, on |
@eerison What Aleksander is saying is that the function is a misnomer:
This function (apparently) is intended not to return the current values of the static variables, but their default values. This feature probably makes sense more for instance rather than static properties. Anyway, this behavior seems correct according to the documentation. |
Ahhhh I got it Yeah that's make sense, i guess this method was used like not recommended 🥲. Ok no problem I changed the implementation from my side. But the question is, shouldn't it be used like this for others projects? Shouldn't it have some warning or deprecation message before change the behavior? As you can see it works like this since 7.4, some informative message could save some hours of debug, it is a really tricky issue to find out 😅. Maybe it should have deprecated on 7.4, but i guess no one was aware of it. Well keep the same behavior makes the upgrades for minor versions smooth, But on the other hand I don't know if it worth the effort. |
@eerison I had another look and I think you might be right after all. It doesn't seem like this change was intentional, but implicitly changed as part of 4b79dba. We don't have a test like your test-case, which is likely why it was missed. Nonetheless, given that the implementation has been like this for years at this point, and it matches the documentation, I'm not sure if fixing it doesn't cause more trouble than it's worth. |
Maybe we could wait if someone else complain about this issue, if yes then we could reopen this issue, and fix it. Because it is a really special case and it isn't documented. |
Description
Hello guys, on
php 8.1 +
contain a break change, it should be the same behaviour for all php 8.x version, shouldn't it?The following code:
https://3v4l.org/KRkS9#v
Resulted in this output:
But I expected this output instead:
PHP Version
PHP 8.1+
Operating System
No response
The text was updated successfully, but these errors were encountered: