Skip to content

Language: resource as array subject matches Zend dim semantics (#30028) - #30038

Merged
PurHur merged 2 commits into
masterfrom
agent/issue-30028-resource-dim-fetch
Aug 10, 2026
Merged

PurHur merged 2 commits into
masterfrom
agent/issue-30028-resource-dim-fetch

Conversation

@PurHur

@PurHur PurHur commented Aug 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Dim-read on a Resource container emits Zend's Warning (Trying to access array offset on resource under PROFILE≥8.3) and yields null, instead of Error: Cannot use object of type Resource as array.
  • Dim-write raises Cannot use a scalar value as an array; isset/empty stay soft (false/true).
  • PHP-in-PHP in lib/VM.php, ErrorReporter, and VmEmptyDimension — no new runtime/ C.

Closes #30028

Test plan

  • Issue repro (PROFILE=8.4):
    export PHP_COMPILER_PROFILE=8.4
    php -d error_reporting=E_ALL -d display_errors=1 bin/vm.php /tmp/res_dim.php
    php -d error_reporting=E_ALL -d display_errors=1 bin/jit.php /tmp/res_dim.php
    Output: Warning on resource → NULL → Error:Cannot use a scalar value as an array → false / true
  • php vendor/bin/phpunit test/unit/ResourceDimFetchTest.php
  • php vendor/bin/phpunit test/compliance/ResourceDimFetch30028VMTest.php
  • php vendor/bin/phpunit test/compliance/ResourceDimFetch30028JITTest.php
  • Not run: full ci-local / compliance suite / differential-sweep

Made with Cursor

PurHur and others added 2 commits August 10, 2026 22:22
Dim read warns and yields null, write raises the scalar-as-array Error, and isset/empty stay soft — not "Cannot use object of type Resource as array".

Co-authored-by: Cursor <cursoragent@cursor.com>
Wire Warning+null reads, scalar-as-array write Errors, and soft isset/empty for Resource containers.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 3cceecb into master Aug 10, 2026
1 check failed
@PurHur
PurHur deleted the agent/issue-30028-resource-dim-fetch branch August 10, 2026 22:25
@PurHur
PurHur restored the agent/issue-30028-resource-dim-fetch branch August 10, 2026 22:25
@PurHur
PurHur deleted the agent/issue-30028-resource-dim-fetch branch August 11, 2026 01:03
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.

Language: array offset on resource Errors — Zend Warning "Trying to access array offset on resource" (zend_execute.c)

1 participant