-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Internal Server Error when calling dump() #34993
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
Small update: I've been playing around a little more, and don't ask me why, but now I get a backtrace on the site (I've cut out the irrelevant part):
I also found out that the error starts happening in version 4.3.2. If I install VarDumper 4.3.1 or lower, everything works as it should |
A small explanation for the backtrace:
What I still don't understand is where the invalid proxy comes from, because regular Another thing I just found out: The exception/server error (depending on the phase of the moon apparently, today I didn't see the exception again, only the server errors) only happens if I dump more than one object: The I was wondering: Would you consider simply wrapping the |
Can you please try this patch? --- a/src/Symfony/Component/VarDumper/Caster/Caster.php
+++ b/src/Symfony/Component/VarDumper/Caster/Caster.php
@@ -54,6 +54,14 @@ class Caster
$class = $class->name;
}
+ if ($hasDebugInfo) {
+ try {
+ $debugInfo = $obj->__debugInfo();
+ } catch (\Exception $e) {
+ // ignore failing __debugInfo()
+ $hasDebugInfo = false;
+ }
+ }
+
$a = $obj instanceof \Closure ? [] : (array) $obj;
if ($obj instanceof \__PHP_Incomplete_Class) {
@@ -89,7 +97,7 @@ class Caster
}
}
- if ($hasDebugInfo && \is_array($debugInfo = $obj->__debugInfo())) {
+ if ($hasDebugInfo && \is_array($debugInfo)) {
foreach ($debugInfo as $k => $v) {
if (!isset($k[0]) || "\0" !== $k[0]) {
$k = self::PREFIX_VIRTUAL.$k; |
@nicolas-grekas I've adapted your patch to 4.4.1 (can't update to 5 due to conflicts), and it looks good: No more server errors, and dumps are displayed normally. Thx! |
This PR was merged into the 3.4 branch. Discussion ---------- [VarDumper] ignore failing __debugInfo() | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #34993 | License | MIT | Doc PR | - Commits ------- eb2eb76 [VarDumper] ignore failing __debugInfo()
Symfony version(s) affected: VarDumper 4.4.1
Description
I'm using the VarDumper component on a project that is not based on Symfony framework. When I try to call
dump()
on certain objects (basically wrapped Doctrine ORM entities, but produced by a custom driver), I get a 500 Server Error. There is no error message on screen (even though XDebug is installed), and nothing in Apache logs or syslog. I've reproduced this on Debian 10.2 , Kubuntu 19.10 (both PHP 7.3.11) and macOS 10.14 (PHP 7.4 from Homebrew).How to reproduce
I have tried following the steps in the reproducer howto, but I can't install the required dependencies due to lots of incomprehensible composer errors. If it helps, I could try to make a repo which reproduces the bug without using the skeleton stuff, but then it'll probably take a few more steps...
Additional context
Not sure it it helps, but this is how the object I'm trying to dump looks in regular
var_dump
:The text was updated successfully, but these errors were encountered: