Skip to content

Stdlib: stream_context_set_option incomplete string form → ValueError (#30645) - #30692

Merged
PurHur merged 1 commit into
masterfrom
fix/30645-stream-context-set-option-overload
Aug 13, 2026
Merged

Stdlib: stream_context_set_option incomplete string form → ValueError (#30645)#30692
PurHur merged 1 commit into
masterfrom
fix/30645-stream-context-set-option-overload

Conversation

@PurHur

@PurHur PurHur commented Aug 13, 2026

Copy link
Copy Markdown
Owner

Summary

  • Match php-src ext/standard/streamsfuncs.c PHP_FUNCTION(stream_context_set_option) overload guards: 2-arg string form and 3-arg string form throw Zend ValueError instead of LogicException / silent true.
  • VM VmStreamContext::setOption no longer synthesizes a null $value for omitted arg Stdlib: round, sqrt, gettype and expanded PHPT specs #4; JIT/AOT lowering uses the same messages via ExceptionBridge::emitValueErrorAndAbort.
  • PHP implementation: ext/standard/VmStreamContext.php, ext/standard/stream_context_set_option.php, ext/standard/JitStreamContextSetOption.php. No new C.

Closes #30645

php-src reference

Test plan

  • VM repro matches Zend 8.2.32
  • JIT repro matches Zend
  • PHPUnit: StreamContextSetOptionIncomplete30645VMTest, StreamContextSetOptionIncomplete30645JITTest, Issue30645StreamContextSetOptionIncompleteTest, AOT @group llvm
  • Related stream_context_set_option* suite (29 tests)

Verification

php test/repro/maintainer_gap_stream_context_set_option_incomplete.php
php bin/vm.php test/repro/maintainer_gap_stream_context_set_option_incomplete.php
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/jit.php test/repro/maintainer_gap_stream_context_set_option_incomplete.php'
./script/phpunit.sh --filter 'StreamContextSetOptionIncomplete30645VMTest|Issue30645StreamContextSetOptionIncompleteTest|StreamContextSetOptionBuiltinTest'
./script/phpunit.sh --filter 'StreamContextSetOptionIncomplete30645JITTest|Issue30645StreamContextSetOptionIncompleteAotTest'
./script/phpunit.sh --filter 'StreamContextSetOption|Issue27295|Issue28344|Issue28680StreamContext'

Zend + VM + JIT output (all identical):

ValueError: stream_context_set_option(): Argument #3 ($option_name) cannot be null when argument #2 ($wrapper_or_options) is a string
ValueError: stream_context_set_option(): Argument #4 ($value) must be provided when argument #2 ($wrapper_or_options) is a string
true
true

PHPUnit: OK (3 tests) VM; OK (4 tests) JIT/AOT; OK (29 tests) related stream-context suite.

./script/ci-fast.sh: AOT smoke OK; failed on check-rebuild-examples-009-sync (examples/README.md 009-FastCGIWeb AOT columns) — this tree did not touch examples/; same README as master.

Not covered

  • Full VMTest / JITTest compliance suites
  • north-star5-verify --strict
  • Differential sweep (no operand/CFG shape change beyond builtin argc/ValueError guards)

Made with Cursor

…#30645)

Match php-src streamsfuncs.c overload guards: 2-arg/3-arg string form throws Zend ValueError instead of LogicException or silent true.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 2fe9261 into master Aug 13, 2026
0 of 2 checks passed
@PurHur
PurHur deleted the fix/30645-stream-context-set-option-overload branch August 13, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: stream_context_set_option string-form incomplete args — LogicException / silent true (ext/standard/streamsfuncs.c)

1 participant