Skip to content

Conversation

iluuu1994
Copy link
Member

No description provided.

Comment on lines +876 to 878
if (smart_str_append_zval(&msg, value, EG(exception_string_param_max_len)) == SUCCESS) {
/* Nothing to do. */
} else {
Copy link
Member

Choose a reason for hiding this comment

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

Maybe?

Suggested change
if (smart_str_append_zval(&msg, value, EG(exception_string_param_max_len)) == SUCCESS) {
/* Nothing to do. */
} else {
if (smart_str_append_zval(&msg, value, EG(exception_string_param_max_len)) == FAILURE) {

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, that looks correct. We only want to emit "of type ..." if smart_str_append_zval() can't handle the value. Note that it intentionally does not handle some values like arrays, because they seem to be handled differently depending on the context. It would be nice if it could be unified in the future, but my intention is not to break BC here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, sorry. I misread your suggestion. :) Yeah, I'll change it!

smart_str_append_scalar(str, value, SIZE_MAX);
if (smart_str_append_zval(str, value, SIZE_MAX) == SUCCESS) {
/* Nothing to do. */
} else if (Z_TYPE_P(value) == IS_ARRAY) {
Copy link
Member

Choose a reason for hiding this comment

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

Can this branch still be reached?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, smart_str_append_zval() does not handle arrays atm, amongst other things.

smart_str_appendl(&msg, "of type ", sizeof("of type ")-1);
smart_str_appends(&msg, zend_zval_type_name(value));
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Line should be reverted

@iluuu1994 iluuu1994 closed this in 998bce1 Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants