Category
stdlib
Problem
get_headers() behavior diverges from Zend/php-src. The in-tree implementation is VM-only and has an argument-index bug for the optional $associative flag (second argument is parsed with position 2).
This also lacks JIT/AOT support (throws).
php-src reference
- php-src:
ext/standard/head.c — PHP_FUNCTION(get_headers)
- Wrapper plumbing (indirect):
main/streams/http_fopen_wrapper.c
Repro
<?php
// 1) arg parsing / flag position
var_dump(get_headers('http://example.com', true));
// 2) non-http URLs: Zend returns false (and may warn depending on wrapper)
var_dump(get_headers('file:///etc/hosts'));
Zend expected
- For (1): returns an array; when
$associative=true, headers are grouped per php-src rules.
- For (2): returns
false with php-src-consistent warning / no-warning behavior for unsupported wrappers.
Current behavior (php-compiler)
- Implementation:
ext/standard/get_headers.php
- Second arg is parsed via
VmMath::parseBoolBuiltinArg(..., argnum=2, ...) even though it is the 2nd parameter.
- JIT/AOT:
call() throws LogicException('get_headers() is not supported in JIT/AOT in this compiler build').
Scope (this repo)
ext/standard/get_headers.php
ext/standard/VmHttpFetchNative.php / VmHttpHeaders.php / VmHttpLastResponseHeaders.php (as needed)
- JIT lowering (optional, preferred):
lib/JIT/Builtin/* or ext/standard/Jit*
Done when
- Repro above matches Zend/php-src under php-src-strict on VM.
$associative parsing uses correct parameter index and php-src-consistent error messages.
- Preferably: JIT no longer throws for
get_headers() (or capability matrix explicitly documents VM-only).
Category
stdlib
Problem
get_headers()behavior diverges from Zend/php-src. The in-tree implementation is VM-only and has an argument-index bug for the optional$associativeflag (second argument is parsed with position 2).This also lacks JIT/AOT support (throws).
php-src reference
ext/standard/head.c—PHP_FUNCTION(get_headers)main/streams/http_fopen_wrapper.cRepro
Zend expected
$associative=true, headers are grouped per php-src rules.falsewith php-src-consistent warning / no-warning behavior for unsupported wrappers.Current behavior (php-compiler)
ext/standard/get_headers.phpVmMath::parseBoolBuiltinArg(..., argnum=2, ...)even though it is the 2nd parameter.call()throwsLogicException('get_headers() is not supported in JIT/AOT in this compiler build').Scope (this repo)
ext/standard/get_headers.phpext/standard/VmHttpFetchNative.php/VmHttpHeaders.php/VmHttpLastResponseHeaders.php(as needed)lib/JIT/Builtin/*orext/standard/Jit*Done when
$associativeparsing uses correct parameter index and php-src-consistent error messages.get_headers()(or capability matrix explicitly documents VM-only).