Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/zend_test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static ZEND_FUNCTION(zend_test_compile_string)

ZEND_PARSE_PARAMETERS_START(3, 3)
Z_PARAM_STR(source_string)
Z_PARAM_STR(filename)
Z_PARAM_PATH_STR_EX(filename, 1, 0)
Z_PARAM_LONG(position)
ZEND_PARSE_PARAMETERS_END();

Expand Down
14 changes: 14 additions & 0 deletions ext/zend_test/tests/zend_test_compile_string.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,32 @@ EOF;

zend_test_compile_string($source_string, 'Source string', ZEND_COMPILE_POSITION_AFTER_OPEN_TAG);

$source_string = <<<EOF
<?php
var_dump('php');
EOF;

try {
zend_test_compile_string($source_string, "Sources\0string", ZEND_COMPILE_POSITION_AT_OPEN_TAG);
} catch (\ValueError $e) {
echo $e->getMessage(), PHP_EOL;
}


$source_string = <<<EOF
<?php
var_dump('php');
EOF;

zend_test_compile_string($source_string, 'Source string', ZEND_COMPILE_POSITION_AFTER_OPEN_TAG);

?>
--EXPECT--
string(3) "php"
#!/path/to/php
string(3) "php"
string(3) "php"
string(3) "php"
zend_test_compile_string(): Argument #2 ($filename) must not contain any null bytes

Parse error: syntax error, unexpected token "<", expecting end of file in Source string on line 1
Loading