Category
bug · php-src-strict · language · include expression as FuncCall arg / two-arg remapping
Problem
var_export(include $path, true) (include nested as the first argument of a two-arg call) does not yield the included file’s return value. VM prints a pid-like integer (same as getmypid() used while building $path) and stringifies that for the second call. Assigning include to a local first, or single-arg wrappers like id(include $path) / strlen(include $path), match Zend.
Same family as closed #24372 (print_r($x, true) as call arg remaps the next literal) and closed #21938 (include/require expression returns).
Probed 2026-07-31 @ 3aa069e85 — Zend 8.2.32 vs php bin/vm.php.
| Repro |
Zend 8.2.32 |
VM (2026-07-31) |
var_export(include $path, true) where file return 7 |
'7' |
pid-like int / '<pid>' |
$a = include $path; var_export($a, true) |
'7' |
'7' ✓ |
id(include $path) / strlen(include $path) |
OK |
OK ✓ |
print_r(include $path, true) (array return) |
OK |
OK ✓ (this shape) |
php-src reference
PHP implementation target
Repro
./script/docker-exec.sh -- bash -lc 'cat > /tmp/ve_include.php <<'"'"'PHP'"'"'
<?php
$path = sys_get_temp_dir() . "/ve_" . getmypid() . ".php";
file_put_contents($path, "<?php return 7;\n");
echo var_export(include $path, true), "\n";
$a = include $path;
echo var_export($a, true), "\n";
@unlink($path);
PHP
php /tmp/ve_include.php
php bin/vm.php /tmp/ve_include.php'
Done when
Category
bug· php-src-strict · language · include expression as FuncCall arg / two-arg remappingProblem
var_export(include $path, true)(include nested as the first argument of a two-arg call) does not yield the included file’s return value. VM prints a pid-like integer (same asgetmypid()used while building$path) and stringifies that for the second call. Assigningincludeto a local first, or single-arg wrappers likeid(include $path)/strlen(include $path), match Zend.Same family as closed #24372 (
print_r($x, true)as call arg remaps the next literal) and closed #21938 (include/require expression returns).Probed 2026-07-31 @
3aa069e85— Zend 8.2.32 vsphp bin/vm.php.var_export(include $path, true)where filereturn 7'7''<pid>'$a = include $path; var_export($a, true)'7''7'✓id(include $path)/strlen(include $path)print_r(include $path, true)(array return)php-src reference
Zend/zend_execute.c—include/requireexpression result as call argext/standard/var.c—PHP_FUNCTION(var_export)PHP implementation target
ARG_SENDtemp wiring inlib/Compiler.phpsoinclude/requireEXEC_RETURNis not stolen by the following literal (true/false) — same class as Language: print_r($x, true) as call arg remaps following string literal onto same temp (Zend/zend_vm_def.c) #24372 / Language: array_keys(ArrayObject/ArrayIterator::getArrayCopy()) gets null — Zend returns keys (zend_execute / temp) #25812runtime/*.cRepro
Done when
var_export(include \$path, true)matches Zend for scalar/array file returnsid(include)/strlen(include)unchanged.phptundertest/compliance/cases/language/