mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
zend_test: zend_test_compile_string converting script argument to path. (#17810)
This commit is contained in:
parent
01a87e0d2d
commit
d3da2a2884
2 changed files with 15 additions and 1 deletions
|
@ -243,7 +243,7 @@ static ZEND_FUNCTION(zend_test_compile_string)
|
||||||
|
|
||||||
ZEND_PARSE_PARAMETERS_START(3, 3)
|
ZEND_PARSE_PARAMETERS_START(3, 3)
|
||||||
Z_PARAM_STR(source_string)
|
Z_PARAM_STR(source_string)
|
||||||
Z_PARAM_STR(filename)
|
Z_PARAM_PATH_STR_EX(filename, 1, 0)
|
||||||
Z_PARAM_LONG(position)
|
Z_PARAM_LONG(position)
|
||||||
ZEND_PARSE_PARAMETERS_END();
|
ZEND_PARSE_PARAMETERS_END();
|
||||||
|
|
||||||
|
|
|
@ -38,12 +38,25 @@ EOF;
|
||||||
|
|
||||||
zend_test_compile_string($source_string, 'Source string', ZEND_COMPILE_POSITION_AFTER_OPEN_TAG);
|
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
|
$source_string = <<<EOF
|
||||||
<?php
|
<?php
|
||||||
var_dump('php');
|
var_dump('php');
|
||||||
EOF;
|
EOF;
|
||||||
|
|
||||||
zend_test_compile_string($source_string, 'Source string', ZEND_COMPILE_POSITION_AFTER_OPEN_TAG);
|
zend_test_compile_string($source_string, 'Source string', ZEND_COMPILE_POSITION_AFTER_OPEN_TAG);
|
||||||
|
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
string(3) "php"
|
string(3) "php"
|
||||||
|
@ -51,5 +64,6 @@ string(3) "php"
|
||||||
string(3) "php"
|
string(3) "php"
|
||||||
string(3) "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
|
Parse error: syntax error, unexpected token "<", expecting end of file in Source string on line 1
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue