-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
PHP Warning: Expected array for frame X #103
Comments
@bileslaw thanks for bringing this up. 👍 I'm having a hard time to reproduce this behavior, is there a script on your side that I can test this with? What are your thoughts on this? |
Hi @SimonFrings 👋 I've just been able to find the minimal working example and the causing code. try {
(function (): never {
throw new Exception();
})();
} catch (Exception $e) {
/**
* The following code is taken from:
* /clue/socks-react/src/Client.php
* /react/socket/src/SecureConnector.php
* (maybe it's repeated elsewhere)
*/
// avoid garbage references by replacing all closures in call stack.
// what a lovely piece of code!
$r = new \ReflectionProperty('Exception', 'trace');
$r->setAccessible(true);
$trace = $r->getValue($e);
// Exception trace arguments are not available on some PHP 7.4 installs
// @codeCoverageIgnoreStart
foreach ($trace as &$one) {
if (isset($one['args'])) {
foreach ($one['args'] as &$arg) {
if ($arg instanceof \Closure) {
$arg = 'Object(' . \get_class($arg) . ')';
}
}
}
}
// @codeCoverageIgnoreEnd
$r->setValue($e, $trace);
echo "{$e}\n"; // empty trace and the warning
} |
@bileslaw Thank you for reporting, I can indeed reproduce the problem you're seeing with the gist you've provided! This is indeed a nasty bug that has been introduced a while ago with #82. This only happens on PHP 7+ when printing the exception trace ( I've started looking into this and will file a PR as soon as time allows 👍 |
@clue Thank you for the prompt action! Just in case, I note again: the same bug is also located in |
@bileslaw Don't worry, on it already! See upstream PRs reactphp/socket#284 ad reactphp/dns#191. I hope this helps! 👍 If so, consider supporting this project, for example by becoming a sponsor ❤️ |
Hello,
It seems that some exceptions cannot be correctly converted to a string.
This is what sometime appears in my log (notice the empty stack traces):
And at the same time, in the PHP log:
The text was updated successfully, but these errors were encountered: