Skip to content

Language: Array to string warning on string-offset assign (#22925) - #22976

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-22925-string-offset-array-warn
Jul 25, 2026
Merged

Language: Array to string warning on string-offset assign (#22925)#22976
PurHur merged 1 commit into
masterfrom
agent/issue-22925-string-offset-array-warn

Conversation

@PurHur

@PurHur PurHur commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • String-offset assign of an array now emits Zend's Array to string conversion warning before Only the first byte will be assigned…, then writes 'A' (first byte of "Array").
  • VM: Variable::byteFromAssignValue — TYPE_ARRAY path + emitArrayToStringWarning fallback Context from the offset slot.
  • JIT: StringOffsetRuntime::assignByte handles TYPE_HASHTABLE with the same two warnings.
  • Compliance + repro guards.

Closes #22925

php-src reference

  • Zend/zend_execute.czend_assign_to_string_offset
  • Zend/zend_operators.c — array → string conversion

PHP implementation

  • lib/VM/Variable.php (php-in-PHP; no new C)
  • lib/JIT/Builtin/StringOffsetRuntime.php + StringOffsetJitHelper::ARRAY_TO_STRING_WARNING

Trust probe (before claim)

Gate Result
bootstrap-inventory --check ok OK 6518/6518 (post-fix)
north-star5-fast red — gen-0 manifest/driver mismatch (#8713 / #22642), pre-existing
vm-driver-probe ok
user_release_ready no (same north-star5-fast)

Test plan

  • Issue repro:
php bin/vm.php test/repro/issue_22925_string_offset_array_assign_warning.php
# W:Array to string conversion
# W:Only the first byte will be assigned to the string offset
# 'Ab'
  • vendor/bin/phpunit --filter string_offset_array_assign_warning → OK
  • Related string_offset_* VM compliance → OK (17)
  • php script/bootstrap-inventory.php --checkOK 6518/6518

C runtime: 0 lines added.

Made with Cursor

Match Zend zend_assign_to_string_offset: coerce array RHS with
Array to string conversion before the first-byte warning.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit de03ef1 into master Jul 25, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-22925-string-offset-array-warn branch July 25, 2026 09:33
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: string offset assign of array omits Array to string conversion warning (Zend/zend_execute.c)

1 participant