Category
bug · php-src-strict · language · require_once / include_once already-loaded return
Problem
After a file has been require_once/include_once’d, Zend returns boolean true for a subsequent once-include. Passing that expression directly into var_export(...) (or similar) under the VM yields a pid-like int instead of true. Storing the second once-include in a temporary first matches Zend.
Distinct from bare require_once as a statement / $x = require_once (those already match). Sibling of #25851 (var_export(include, true) two-arg remap).
Probed 2026-07-31 @ 3aa069e85 — Zend 8.2.32 vs php bin/vm.php.
| Repro |
Zend 8.2.32 |
VM (2026-07-31) |
require_once $path; var_export(require_once $path); (return 42 file) |
true |
pid-like int |
$a=require_once $path; $b=require_once $path; var_export($b) |
true |
true ✓ |
First require_once expression value |
42 |
42 ✓ |
php-src reference
PHP implementation target
- Ensure already-loaded
*_once produces a real boolean true temp when used as a call argument (not a stolen prior getmypid/path temp)
lib/ compile + VM include path; PHP-in-PHP only
Repro
./script/docker-exec.sh -- bash -lc 'cat > /tmp/ve_require_once.php <<'"'"'PHP'"'"'
<?php
$path = sys_get_temp_dir() . "/ro_" . getmypid() . ".php";
file_put_contents($path, "<?php return 42;\n");
require_once $path;
echo var_export(require_once $path, true), "\n";
$a = require_once $path;
$b = require_once $path;
echo var_export($a, true), "|", var_export($b, true), "\n";
@unlink($path);
PHP
php /tmp/ve_require_once.php
php bin/vm.php /tmp/ve_require_once.php'
Done when
Category
bug· php-src-strict · language · require_once / include_once already-loaded returnProblem
After a file has been
require_once/include_once’d, Zend returns booleantruefor a subsequent once-include. Passing that expression directly intovar_export(...)(or similar) under the VM yields a pid-like int instead oftrue. Storing the second once-include in a temporary first matches Zend.Distinct from bare
require_onceas a statement /$x = require_once(those already match). Sibling of #25851 (var_export(include, true)two-arg remap).Probed 2026-07-31 @
3aa069e85— Zend 8.2.32 vsphp bin/vm.php.require_once $path; var_export(require_once $path);(return 42file)true$a=require_once $path; $b=require_once $path; var_export($b)truetrue✓require_onceexpression value4242✓php-src reference
Zend/zend_execute.c— once-include already-loaded returnstrueZend/zend_compile.c—ZEND_INCLUDE_OR_EVALPHP implementation target
*_onceproduces a real booleantruetemp when used as a call argument (not a stolen priorgetmypid/path temp)lib/compile + VM include path; PHP-in-PHP onlyRepro
Done when
var_export(require_once \$path)/var_export(include_once \$path)after first load printstrue.phptundertest/compliance/cases/language/