Skip to content

Conversation

TimWolla
Copy link
Member

Following #19565 (comment).

Copy link
Member

@DanielEScherzer DanielEScherzer left a comment

Choose a reason for hiding this comment

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

I'm around a -0.5 on this generally, and maybe -0.75 on this for PHP 8.5 - @edorian, what do you think?

@@ -86,6 +86,8 @@ PHP 8.5 INTERNALS UPGRADE NOTES
. zend_mm_refresh_key_child() must be called on any zend_mm_heap inherited
from the parent process after a fork().
. HASH_KEY_IS_* constants have been moved in the zend_hash_key_type enum.
. ZSTR_INIT_LITERAL() now supports strings containing NUL bytes. Passing
non-literal char* is no longer supported.
Copy link
Member

Choose a reason for hiding this comment

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

The dropping of support for non-literal char* seems like a disadvantage - I'm not fully convinced of the benefits of this patch (were there any places that the macro was specifically avoided because of NUL bytes?) especially given where we are in the release cycle, where external extensions have likely already started updating for PHP 8.5.

Copy link
Member Author

Choose a reason for hiding this comment

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

were there any places that the macro was specifically avoided because of NUL bytes?

I did not check. Your comment on the other PR prompted me to look into the definition of the macro and then I noticed the issue.

The dropping of support for non-literal char* seems like a disadvantage

The “literal” in the name of the macro to me is an indication that it was not meant to support non-literal strings. Just like we have zend_string_starts_with_cstr() (char*) + length and zend_string_starts_with_literal().

But I'm seeing that zend_string_starts_with_literal() has the same issue as ZSTR_INIT_LITERAL(). They should all be adjusted at the same time then and then it also makes sense to me to move this to 8.6.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah zend_string_equals_literal() is fine, zend_string_starts_with_literal() and zend_string_starts_with_literal_ci() are not.

@TimWolla TimWolla marked this pull request as draft August 25, 2025 09:47
@TimWolla TimWolla force-pushed the zstr-init-literal-nul branch from c76cf66 to d7bfdcc Compare August 25, 2025 09:52
@TimWolla TimWolla changed the title zend_string: Support NUL bytes in ZSTR_INIT_LITERAL() zend_string: Support NUL bytes in ZSTR_*_LITERAL() and zend_string_*literal*() Aug 25, 2025
@iluuu1994
Copy link
Member

As the person who introduced ZSTR_INIT_LITERAL(), restricting it to actual string literals makes sense to me. Whether this should be delayed to 8.6 is at the RMs discretion.

@TimWolla TimWolla force-pushed the zstr-init-literal-nul branch from d7bfdcc to 3ba7252 Compare August 27, 2025 08:25
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.

3 participants