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
Fixes fatal error if query params is a data dumper object instead of array #758
Conversation
@@ -88,7 +88,9 @@ private function explainSQLServerPlatform(Connection $connection, $query) | |||
|
|||
private function explainOtherPlatform(Connection $connection, $query) | |||
{ | |||
return $connection->executeQuery('EXPLAIN '.$query['sql'], $query['params'], $query['types']) | |||
$params = $query['params'] instanceof Data ? $query['params']->getValue(true) : $query['params']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is Data
? There is no import for this class and Doctrine\Bundle\DoctrineBundle\Controller\Data doesn't exist either - probably missing import?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've missed to add the import. It's done now
👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch fixes a symptom, not the root cause. Replacing a value with a Symfony\Component\VarDumper\Cloner\Data
is the root cause of the issue. This patch is therefore invalid, and the root cause is to be fixed instead.
@Ocramius meanwhile, this is still broken. Where should we look for the root cause ? |
+1 |
If you can reproduce it, send a test case. This simply needs someone with time and a debugger, looking fir the location where the |
I have it in my project, I see there is a conversion supposed to be done in the |
Ok |
@florentdestremau When I was looking around at this I somehow got the impression that this is intentional, probably to provide the pretty collapsible dump of query's parameters. That's why I initially opted for this fix (BC-safe, no side effects). Needless to say this impression is not based on evidence so it may be completely wrong :) When you look at the issue have this in mind and check if the fix won't break the dump as well. |
Well I am now wondering if the good design is to actually use |
Ok I found the place where query params are converted to
The
Waiting for your thoughts @Ocramius and I'm ready to make a PR |
Wrapping collected data into a VarDumper Data is the expected behavior in the profiler collector though (it avoids issue with non-serializable data and so on) |
In this case then we are missing a "convert to array" and this PR is relevant, although it might be done straight in the controller rather than in last-minute before the |
Looks like a lot of wrong stuff is happening in there anyway:
|
@Ocramius the getQueries method comes from the I am willing to make the changes if needed, I just need the list, so far:
The getQueries come with a |
Need to figure out when the BC break was introduced first, so we can decide if it needs reverting or adapting. |
Well, storing the collected data in a Data object was an intended change in Symfony 3. And some parts of the bundle have already been updated to follow the latest profiler enhancements. It is just that the controller explaining queries was forgotten. |
@Ocramius @stof I would like to help here as I'm directly concerned (and use my own clone in local now) but I don't know what to do or check for this issue to go forward (or #757 for the reference). If One might consider moving this conversation back to the original issue rather than in a PR ? |
refs #757