Skip to content

Language: deny Generator serialize/unserialize like Zend (#23044)#23082

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-23044-generator-serialize
Jul 25, 2026
Merged

Language: deny Generator serialize/unserialize like Zend (#23044)#23082
PurHur merged 1 commit into
masterfrom
agent/issue-23044-generator-serialize

Conversation

@PurHur

@PurHur PurHur commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • Reject serialize() / unserialize() of Generator with Zend-identical Exception messages (Zend/zend_generators.c serialize/unserialize deny).
  • Mirror the existing Closure/Fiber deny paths in VmSerialize (encode + export + unserialize header).
  • Compliance .phpt + repro; Closure deny asserted first.

Closes #23044

php-src reference

  • Zend/zend_generators.czend_class_serialize_deny / zend_class_unserialize_deny

PHP implementation

  • ext/standard/VmSerialize.php (PHP-in-PHP; no new runtime/*.c)

Test plan

  • php bin/vm.php test/repro/issue_23044_generator_serialize.php
  • ./script/phpunit.sh --filter generator_serialize_disallowed → OK (2 tests)
  • Host PHPT expect match for generator_serialize_disallowed.phpt

Verification

$ php bin/vm.php test/repro/issue_23044_generator_serialize.php
closure:Exception:Serialization of 'Closure' is not allowed
Exception:Serialization of 'Generator' is not allowed
Exception:Unserialization of 'Generator' is not allowed

$ ./script/phpunit.sh --filter generator_serialize_disallowed
OK (2 tests, 2 assertions)

Note: full GeneratorVMTest still has a pre-existing red on generator_finally_early_close.phpt (FIN_UNSET missing) on this tree — unrelated to serialize deny.

Trust snapshot: inventory OK; north-star5-fast red on gen-0 stale (#22642) — unrelated pillar 1.

Match php-src zend_generators.c serialize/unserialize deny handlers so
serialize($generator) throws Exception instead of emitting O: wire.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur force-pushed the agent/issue-23044-generator-serialize branch from 44362cd to 232ca35 Compare July 25, 2026 17:47
@PurHur
PurHur merged commit d180f2d into master Jul 25, 2026
@PurHur
PurHur deleted the agent/issue-23044-generator-serialize branch July 25, 2026 17:47
PurHur added a commit that referenced this pull request Jul 25, 2026
Master moved (Generator/WeakMap serialize) while the prior restamp was in
flight; live fingerprint is now 95e2817e… (was bf9335d2…). Keep
provenance=unverified-restamp.

Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur added a commit that referenced this pull request Jul 25, 2026
…23085)

* Trust: restamp gen-0 fingerprint after #23078#23083 drift (#10533)

Pillar 1: north-star5-verify --fast step 4f-m failed (94f60af8… vs live
bf9335d2…) after empty()/CurlHandle/SensitiveParameterValue/GD2/SimpleXML
serialize merges. Stamp with BOOTSTRAP_GEN0_ALLOW_UNVERIFIED_STAMP=1 so
provenance stays unverified-restamp (#22966). Honest verified-fresh
rebuild remains #22717.

Co-authored-by: Cursor <cursoragent@cursor.com>

* Trust: restamp gen-0 fingerprint after #23082/#23084 drift (#10533)

Master moved (Generator/WeakMap serialize) while the prior restamp was in
flight; live fingerprint is now 95e2817e… (was bf9335d2…). Keep
provenance=unverified-restamp.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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: Generator serialize() allowed — Zend Exception "not allowed" (Zend/zend_generators.c)

1 participant