mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Fix GH-17831: zend_test_compile_string crash on nul bytes check. (#17832)
Setting check_null previously was due to misunderstanding its purpose
This commit is contained in:
@@ -243,7 +243,7 @@ static ZEND_FUNCTION(zend_test_compile_string)
|
||||
|
||||
ZEND_PARSE_PARAMETERS_START(3, 3)
|
||||
Z_PARAM_STR(source_string)
|
||||
Z_PARAM_PATH_STR_EX(filename, 1, 0)
|
||||
Z_PARAM_PATH_STR(filename)
|
||||
Z_PARAM_LONG(position)
|
||||
ZEND_PARSE_PARAMETERS_END();
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ try {
|
||||
echo $e->getMessage(), PHP_EOL;
|
||||
}
|
||||
|
||||
zend_test_compile_string(null, null, null);
|
||||
|
||||
$source_string = <<<EOF
|
||||
<?php
|
||||
@@ -58,7 +59,7 @@ EOF;
|
||||
zend_test_compile_string($source_string, 'Source string', ZEND_COMPILE_POSITION_AFTER_OPEN_TAG);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
string(3) "php"
|
||||
#!/path/to/php
|
||||
string(3) "php"
|
||||
@@ -66,4 +67,10 @@ string(3) "php"
|
||||
string(3) "php"
|
||||
zend_test_compile_string(): Argument #2 ($filename) must not contain any null bytes
|
||||
|
||||
Deprecated: zend_test_compile_string(): Passing null to parameter #1 ($source_string) of type string is deprecated in %s on line %d
|
||||
|
||||
Deprecated: zend_test_compile_string(): Passing null to parameter #2 ($filename) of type string is deprecated in %s on line %d
|
||||
|
||||
Deprecated: zend_test_compile_string(): Passing null to parameter #3 ($position) of type int is deprecated in %s on line %d
|
||||
|
||||
Parse error: syntax error, unexpected token "<", expecting end of file in Source string on line 1
|
||||
|
||||
Reference in New Issue
Block a user