Category
bug · php-src-strict · Reflection return type · ext/standard
Problem
ReflectionFunction('tmpfile') / ReflectionFunction('fopen') advertise return type resource on php-compiler. Zend/php-src stubs leave both untyped (hasReturnType() === false). Probed 2026-08-07 @ cee406e863.
| Repro |
Zend 8.2 (2026-08-07) |
VM (2026-08-07) |
(new ReflectionFunction('tmpfile'))->hasReturnType() |
false |
true (resource) |
(new ReflectionFunction('fopen'))->hasReturnType() |
false |
true (resource) |
php-src reference
PHP implementation target
- Reflection / arginfo for
tmpfile and fopen in ext/standard — drop invented resource return type to match stubs
Repro
./script/docker-exec.sh -- bash -lc "php -r \"\$r=new ReflectionFunction('tmpfile'); var_export([\$r->hasReturnType(), \$r->hasReturnType()?(string)\$r->getReturnType():null]);\""
./script/docker-exec.sh -- bash -lc "php bin/vm.php -r \"\$r=new ReflectionFunction('tmpfile'); var_export([\$r->hasReturnType(), \$r->hasReturnType()?(string)\$r->getReturnType():null]);\""
./script/docker-exec.sh -- bash -lc "php -r \"\$r=new ReflectionFunction('fopen'); var_export([\$r->hasReturnType(), \$r->hasReturnType()?(string)\$r->getReturnType():null]);\""
./script/docker-exec.sh -- bash -lc "php bin/vm.php -r \"\$r=new ReflectionFunction('fopen'); var_export([\$r->hasReturnType(), \$r->hasReturnType()?(string)\$r->getReturnType():null]);\""
Done when
Category
bug· php-src-strict · Reflection return type · ext/standardProblem
ReflectionFunction('tmpfile')/ReflectionFunction('fopen')advertise return typeresourceon php-compiler. Zend/php-src stubs leave both untyped (hasReturnType() === false). Probed 2026-08-07 @cee406e863.(new ReflectionFunction('tmpfile'))->hasReturnType()falsetrue(resource)(new ReflectionFunction('fopen'))->hasReturnType()falsetrue(resource)php-src reference
ext/standard/basic_functions.stub.php—function tmpfile() {}/function fopen(string $filename, string $mode, bool $use_include_path = false, $context = null) {}(no return type)PHP implementation target
tmpfileandfopeninext/standard— drop inventedresourcereturn type to match stubsRepro
Done when
tmpfile/fopenhave no return type (match Zend)