Skip to content

Commit 3b82367

Browse files
authored
Fix GH-17831: zend_test_compile_string crash on nul bytes check. (#17832)
Setting check_null previously was due to misunderstanding its purpose
1 parent a1da7ca commit 3b82367

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

ext/zend_test/test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ static ZEND_FUNCTION(zend_test_compile_string)
243243

244244
ZEND_PARSE_PARAMETERS_START(3, 3)
245245
Z_PARAM_STR(source_string)
246-
Z_PARAM_PATH_STR_EX(filename, 1, 0)
246+
Z_PARAM_PATH_STR(filename)
247247
Z_PARAM_LONG(position)
248248
ZEND_PARSE_PARAMETERS_END();
249249

ext/zend_test/tests/zend_test_compile_string.phpt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ try {
4949
echo $e->getMessage(), PHP_EOL;
5050
}
5151

52+
zend_test_compile_string(null, null, null);
5253

5354
$source_string = <<<EOF
5455
<?php
@@ -58,12 +59,18 @@ EOF;
5859
zend_test_compile_string($source_string, 'Source string', ZEND_COMPILE_POSITION_AFTER_OPEN_TAG);
5960

6061
?>
61-
--EXPECT--
62+
--EXPECTF--
6263
string(3) "php"
6364
#!/path/to/php
6465
string(3) "php"
6566
string(3) "php"
6667
string(3) "php"
6768
zend_test_compile_string(): Argument #2 ($filename) must not contain any null bytes
6869

70+
Deprecated: zend_test_compile_string(): Passing null to parameter #1 ($source_string) of type string is deprecated in %s on line %d
71+
72+
Deprecated: zend_test_compile_string(): Passing null to parameter #2 ($filename) of type string is deprecated in %s on line %d
73+
74+
Deprecated: zend_test_compile_string(): Passing null to parameter #3 ($position) of type int is deprecated in %s on line %d
75+
6976
Parse error: syntax error, unexpected token "<", expecting end of file in Source string on line 1

0 commit comments

Comments
 (0)