-
Notifications
You must be signed in to change notification settings - Fork 79
Method Zend\Code\Generator\ValueGenerator::__toString() must not throw an exception (with PHP 7.3) #178
Comments
@k00ni Since PHP 7.4 we can throw exceptions in Can you provide more details about your use case when you are getting the exception? Thanks! |
Hi @michalbundyra, thank you for the quick reply.
Ok, good to know :)
I am running PHP My use case involves:
When running a simple test which requires the
I am not familiar with Symfony, Doctrine or Zend internals, therefore can't located the source of the error. I am not even sure, if that is "your" problem, but i thought its a good start to ask the first one in the line. EDIT: It must be related to |
I moved on to another solution for my problem, which means, i don't get this error anymore. But it maybe still of interest to you. Please close, if not. |
@k00ni I see the issue - in case value is resource in the exception message we try to get_class of resource, which is not working: zend-code/src/Generator/ValueGenerator.php Lines 438 to 442 in a277be9
Still, seems to be that your code in some place is (was?) invalid. Would you be able to share your solution which solve your problem, please? |
I had problems getting PHPUnit 8.x + Doctrine 2.7 running with Symfony 4.4.1. There was no PHP code involved, only YAML configuration. After hours of searching it resulted in the following solution: symfony/symfony-docs#12788 (comment) . I got the error above when trying to setup Doctrine to use entity manager in PHPUnit integration tests. Unfortunately, i can't find my configuration at that time anymore. I am still new to this and its hard to track all these changes and new features/components. |
Thank you for the refinements. |
The class ValueGenerator may throw an exception inside
__toString
which is forbidden (look forExceptions can not be thrown from __toString() methods.
) and leads to a fatal error in my case. I am running a Symfony application, which indirectly useszend-code
.Are you aware of this? I would propose moving the functionality in a separate function or not throw an exception in
__toString
(or referenced functions) at all.Thank you for the feedback.
The text was updated successfully, but these errors were encountered: