Skip to content

Conversation

@devnexen
Copy link
Member

happens with unset script path, now using zend_str_has_nul_bytes thereafter.

happens with unset script path, now using zend_str_has_nul_bytes
thereafter.
@devnexen devnexen linked an issue Feb 16, 2025 that may be closed by this pull request

zend_op_array *op_array = NULL;

if (zend_str_has_nul_byte(filename)) {
Copy link
Member

Choose a reason for hiding this comment

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

Using PATH_STR makes this condition not necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

but it seems PATH_STR does not do the check_null part. no ?

Copy link
Member

Choose a reason for hiding this comment

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

check_null means checking for a NULL argument instead of a string, not for NUL bytes.
The bug here was that you passed 1 to check_null instead of 0. And passing 0 is equivalent to PATH_STR without the EX

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 gotcha yes not the same thing at 2nd look.

Copy link
Member

Choose a reason for hiding this comment

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

The whole reason we have PATH_STR is to check for NUL bytes in the string, that's the only difference with normal STR fast-ZPP

echo $e->getMessage(), PHP_EOL;
}

zend_test_compile_string($x, $y, $z);
Copy link
Member

Choose a reason for hiding this comment

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

I'd just pass NULLs to avoid the warning on undef var

@devnexen devnexen merged commit 3b82367 into php:master Feb 16, 2025
9 checks passed
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.

SEGV zend_test_compile_string undefined var

2 participants