Category
stdlib · php-src-strict · compile/lowering
Problem
stream_context_set_options($ctx, ['http' => ['timeout' => 1]]) fatals: Argument #2 ($options) must be of type array, null given.
Passing the same array via a variable works. Inline array literals are not lowered to the second argument.
Related umbrella: #3448 — this is the concrete inline-literal repro.
php-src reference
Repro
test/repro-maintainer/parity_stream_context_set_options_inline.php
<?php
declare(strict_types=1);
$ctx = stream_context_create();
stream_context_set_options($ctx, ['http' => ['timeout' => 1]]);
$got = stream_context_get_options($ctx);
echo 'timeout=', ($got['http']['timeout'] ?? 'missing'), PHP_EOL;
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro-maintainer/parity_stream_context_set_options_inline.php'
| Form |
Zend (8.4+) |
VM today |
| Inline array literal 2nd arg |
OK |
TypeError: … null given ❌ |
| Variable holding array |
OK |
OK ✅ |
Implementation hints (PHP-in-PHP)
- Likely named-arg / call lowering bug for internal builtins — check compile path for
stream_context_set_options in lib/Compiler.php and ext/standard/stream_context_set_options.php.
- Runtime merge logic already in
ext/standard/VmStreamContext.php — fix argument materialization, not C.
Done when
Category
stdlib· php-src-strict · compile/loweringProblem
stream_context_set_options($ctx, ['http' => ['timeout' => 1]])fatals: Argument #2 ($options) must be of type array, null given.Passing the same array via a variable works. Inline array literals are not lowered to the second argument.
Related umbrella: #3448 — this is the concrete inline-literal repro.
php-src reference
ext/standard/streams.c—php_stream_context_set_optionsext/standard/basic_functions.stub.php— PHP 8.4stream_context_set_optionsRepro
test/repro-maintainer/parity_stream_context_set_options_inline.phpTypeError: … null given❌Implementation hints (PHP-in-PHP)
stream_context_set_optionsinlib/Compiler.phpandext/standard/stream_context_set_options.php.ext/standard/VmStreamContext.php— fix argument materialization, not C.Done when