Category
stdlib · php-src-strict · stream context option arity · pillar 4
Problem
When argument #2 is a string wrapper name, php-src requires the 4-arg form. Incomplete calls must throw ValueError with Zend's messages. Tip throws LogicException for the 2-arg string form and incorrectly returns true for the 3-arg form (treats missing $value as success).
Probed 2026-08-13 @ 947fc073d6 vs host Zend 8.2.32. VM (+ PROFILE=8.4) red.
| Repro |
Zend 8.2.32 |
VM |
stream_context_set_option($c, 'http') |
ValueError: … Argument #3 ($option_name) cannot be null when argument #2 ($wrapper_or_options) is a string |
LogicException: stream_context_set_option(): missing wrapper/option/value arguments |
stream_context_set_option($c, 'http', 'method') |
ValueError: … Argument #4 ($value) must be provided when argument #2 ($wrapper_or_options) is a string |
true (wrong success) |
stream_context_set_option($c, ['http'=>['method'=>'GET']]) |
true |
true (OK) |
stream_context_set_option($c, 'http', 'method', 'GET') |
true |
true (OK) |
php-src reference
PHP implementation target
ext/standard/VmStreamContext.php — setOption(): when $arg2 is string and $arg3/$arg4 missing, throw Zend ValueError texts (not LogicException); do not return true for 3-arg string form
- Mirror VM entry / JIT path for
stream_context_set_option if it duplicates the guard
- Keep PHP-in-PHP; no new
runtime/*.c logic
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_stream_context_set_option_incomplete.php'
Inline:
<?php
$c = stream_context_create();
try { var_export(stream_context_set_option($c, 'http')); } catch (Throwable $e) { echo get_class($e), ': ', $e->getMessage(), \"\n\"; }
try { var_export(stream_context_set_option($c, 'http', 'method')); } catch (Throwable $e) { echo get_class($e), ': ', $e->getMessage(), \"\n\"; }
Done when
Category
stdlib· php-src-strict · stream context option arity · pillar 4Problem
When argument #2 is a string wrapper name, php-src requires the 4-arg form. Incomplete calls must throw
ValueErrorwith Zend's messages. Tip throwsLogicExceptionfor the 2-arg string form and incorrectly returnstruefor the 3-arg form (treats missing$valueas success).Probed 2026-08-13 @
947fc073d6vs host Zend 8.2.32. VM (+ PROFILE=8.4) red.stream_context_set_option($c, 'http')ValueError: … Argument #3 ($option_name) cannot be null when argument #2 ($wrapper_or_options) is a stringLogicException: stream_context_set_option(): missing wrapper/option/value argumentsstream_context_set_option($c, 'http', 'method')ValueError: … Argument #4 ($value) must be provided when argument #2 ($wrapper_or_options) is a stringtrue(wrong success)stream_context_set_option($c, ['http'=>['method'=>'GET']])truetrue(OK)stream_context_set_option($c, 'http', 'method', 'GET')truetrue(OK)php-src reference
ext/standard/streamsfuncs.c—PHP_FUNCTION(stream_context_set_option)string vs array formsext/standard/basic_functions.stub.php— overloadsPHP implementation target
ext/standard/VmStreamContext.php—setOption(): when$arg2is string and$arg3/$arg4missing, throw ZendValueErrortexts (notLogicException); do not returntruefor 3-arg string formstream_context_set_optionif it duplicates the guardruntime/*.clogicRepro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_stream_context_set_option_incomplete.php'Inline:
Done when
ValueError(Stdlib: ceil, floor, intval and expanded PHPT specs #3 cannot be null …)ValueError(Stdlib: round, sqrt, gettype and expanded PHPT specs #4 must be provided …); never returnstrue.phptundertest/compliance/cases/(streams/)