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
Serialization of mocked objects in PHP 7.4 #1038
Comments
I see this has been "fixed" in 7.4 RC1: So I think this means mocks can not be serialized anymore. |
Mockery could, if it really wanted, make its mocks serializable, at least naively, by making sure the mocks own usage of reflection stuff was restored using custom code. However, serializing of partial mocks or mocks that have reflection stuff as expected return values, etc, will need more care (and maybe should not be supported). |
I having the same issue here when trying to execute some tests
Any leads? |
Serialization of 'TYPO3\CMS\Extbase\Reflection\MethodReflection' is not allowed in typo3 8.7.8 with php 7.4 This error not come when we use php 7.2 so why come in php 7.4. Any solution? |
Any updates on this? |
2 similar comments
Any updates on this? |
Any updates on this? |
For me it happens with \Exception used inside the test and only when
If the test is correct, the error will not show. If there is something wrong in the test, I disable @runTestsInSeparateProcesses / @preserveGlobalState disabled, I fix the tests and then enable those again. |
Same conditions for me |
Exception stacktrace may contain unseralizable objects like Closure or Reflection. Since PHP 7.4 you need to enable |
This snippet of code:
works with Mockery 1.3.1, using PHP 7.3.
Using PHP 7.4, keeping all else equal, it gives the exception:
I suspect it's because of the changes merged into 7.4 after this RFC:
https://wiki.php.net/rfc/custom_object_serialization
However, that RFC claims to not have any BC-breaking changes.
Is there something that can be done to remedy this from the side of Mockery, or should this be considered a core PHP bug?
The text was updated successfully, but these errors were encountered: