Skip to content
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

A non-numeric value encountered in Stacktrace.php #816

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Stacktrace.php
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ protected function getFrameArgumentsValues(array $frame): array
$result = array_map([$this, 'serializeArgument'], $frame['args']);
} else {
foreach (array_values($frame['args']) as $index => $argument) {
$result['param' . ($index + 1)] = $this->serializeArgument($argument);
$result['param' . ((int)$index + 1)] = $this->serializeArgument($argument);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, the culprit of the problem as we found out is XDebug. The error occurs because it changes how the arguments of a stacktrace frame are reported by using the argument name as key of each value of the $args variable instead of its 0-based position in the function signature. Blindly casting $index to an integer then would result in some indesiderate results (e.g. foo would be converted to 0). The best fix we can do is to check whether the $index variable is a string or an integer and act accordingly. However, this exact same issue should have been fixed in #761 which is the reason why there is an if/else statement wrapping the loop, so I don't get why it happens and it would be cool if you could debug a bit more in depth to see what's happening

}
}

Expand Down