-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Fatal error: Unsupported operand types in ResourceCaster::castStream #23151
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
Comments
After #23082 I do not observe the problem with nullErrorHandler, thanks. And about the "Fatal error: Unsupported operand types" - I myself can not say exactly why this happens, but say that this happens only when using server_log. I tested this with the "bin/console server:log" on and off. I added a value check to the array to castStream and, in case of an error, added var_dump. That's what happened, maybe this will somehow help:
My configuration is:
On macOS Sierra 10.12.5 (16F73) |
where is this "context" entry coming from? |
cal you please try this patch? --- a/src/Symfony/Component/VarDumper/Caster/ResourceCaster.php
+++ b/src/Symfony/Component/VarDumper/Caster/ResourceCaster.php
@@ -50,7 +50,7 @@ class ResourceCaster
public static function castStreamContext($stream, array $a, Stub $stub, $isNested)
{
- return stream_context_get_params($stream);
+ return stream_context_get_params($stream) ?: array();
} |
This PR was merged into the 2.7 branch. Discussion ---------- [VarDumper] fixes | Q | A | ------------- | --- | Branch? | 2.7 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | #23115 and #23151 (hopefully) | License | MIT | Doc PR | - it looks like stream_context_get_params can return false (looking at php-src and #23151) and doing a foreach on SplObjectStorage changes its internal iterator state. Commits ------- d7238c9 [VarDumper] fixes
Uh oh!
There was an error while loading. Please reload this page.
I have the following standard logging configuration for dev environment:
I found the problem that when a 500th error occurs (because of the PHP Fatal error – Call to a member function getCategory() on null), the web debug toolbar is not loaded, and then pop-up appears with the text: "An error occurred while loading the web debug toolbar (404: Not Found)".
In the error log, I found that another fatal error occurs in the ResourceCaster::castStream method:
Here's the code snippet that leads to the error:
I think that it is worth doing the validation of the value of $a and the result of castStreamContext before adding them to solve this problem. How do you think?
My logs here:
error.txt
And, by the way, if you pay attention to the logs, you can find another problem:
I think the nullErrorHandler method should be public.
The text was updated successfully, but these errors were encountered: