-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
Fix GH-16814: MessageFormatter::format throws an error on invalid arr… #16816
Conversation
string_arg: | ||
/* This implicitly converts objects | ||
* Note that our vectors will leak if object conversion fails | ||
* and PHP ends up with a fatal error and calls longjmp | ||
* as a result of that. | ||
*/ | ||
str = zval_get_tmp_string(elem, &tmp_str); | ||
if (!try_convert_to_string(elem)) { |
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 believe this will implicitly modify the array. Can we skip the entire iteration when the parameter is unsed?
Honestly, I think throwing away the exception is pretty bad. What if the entry is actually used and the __toString() legitimately throws? I also think this isn't a bug in the first place: |
I kind of agree with you (one of the reasons I keep it as draft), I was just trying to see what s possible but ultimately looking at the code so many times, it is mostly good as is.. |
I agree that exceptions should not be discarded. What I was suggesting is trying to skip the coercion to string in the first place. But as Niels has mentioned, IMO this is definitely not a bug, and might not even be a worthwhile feature. |
…ay element.