-
-
Notifications
You must be signed in to change notification settings - Fork 70
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
Cause error: Error: Cannot access trait constant self::CONTROL_FLASH_MESSAGE directly #315
Comments
Could you please report this as a PHP bug as well? That ReflectionParameter::getDefaultValue() crashes in this situation? |
The old version with |
So where's the problem? |
The problem is in the new version, where the code |
So |
Nette\DI 3.2.0 works well |
It is really strange, because when I tried to isolate the root cause in the 3v4l.org, it works also with the |
What is the difference between |
Sorry my fault :( I was reporting and speaking about But you are speaking about |
It happens only when $method is got from the trait reflection instead of the class reflection https://3v4l.org/s8ofg#v8.3.7 (Interesting side-note: PHP allows to redefine constant value if it is defined by interface and overriden by a class or a trait, but constant value defined by a trait can't be redefined by a class, PHP would throw fatal error for that - https://3v4l.org/oYmEW#v8.3.7) |
Great point @mabar. When I debug/try/catch/parse and then debug the situation that happening in my code, the The previous mechanism was safe, because it was parsing the constant value different way than current version, that try to access the trait constant directly. So the |
And that brings us back to whether you could report this as a bug on PHP, because it should work. |
@dg Im not sure with that. A) I have never report a bug to PHP. Where should I do that? B) I think, that it is not a bug of PHP. You cant call PHP When you call the reflection on the class that use the trait, it works. What do you think? |
Last change on this line cause an error.
di/src/DI/DependencyChecker.php
Line 182 in f9ca71d
Previous code works well
When I have a Presenter that use trait that contains the following code:
The text was updated successfully, but these errors were encountered: