Language: typed property write enforcement on VM (#169) - #3828
Merged
Merged
Conversation
Persist union/readonly property metadata from the compiler, reject invalid assignments (array→scalar, union mismatch) with Zend-style TypeError messages, and restore instance readonly enforcement via a php-cfg property-readonly patch. Co-authored-by: Cursor <cursoragent@cursor.com>
PurHur
force-pushed
the
agent/issue-169-typed-properties
branch
from
May 30, 2026 15:23
c2e1501 to
b60925c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
array→string,array→int|string) with Zend-styleTypeErrormessages matchingzend_verify_property_type/zend_type.c.unionTypeConstraints,declaredTypeLabel) and handle scalar weak coercion without array/object → string conversion.readonlyproperty enforcement: php-cfg previously strippedMODIFIER_READONLYfrom property visibility; newphp-cfg-property-readonly.patchpreserves the flag (promoted readonly already worked viapromotionReadonly).php-src reference
Zend/zend_execute.c—ZEND_ASSIGN_OBJ, typed property checksZend/zend_type.c— union assignabilityZend/zend_object_handlers.c— readonly property guardVerification
Repro (VM now matches Zend):
Closes #169
Made with Cursor