Repository navigation
Conversation
PHP 8.5 deprecates SplObjectStorage::attach() and contains(), so every dump() of a DataObject or DataSet emitted deprecation notices there. offsetSet()/offsetExists() through array access are equivalent and available on all supported PHP versions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Hackwar
force-pushed
the
4.x-splobjectstorage-array-access
branch
from
November 12, 2026 23:14
9682e3a to
f086363
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 of Changes
PHP 8.5 deprecates
SplObjectStorage::attach()andSplObjectStorage::contains().DataObject::dump(),DataObject::dumpProperty()andDataSet::dump()use them to track already-dumped objects, so everydump()(and everyjson_encode()of aDataObject) emits deprecation notices on PHP 8.5, and the calls will fail on PHP 9.They are replaced by array access (
$dumped[$this] = null,isset($dumped[$value])), i.e.offsetSet()/offsetExists(), which PHP recommends as the replacement and which behave the same on every supported PHP version. No behaviour change, so this goes to 4.x rather than waiting for 5.0.Testing Instructions
DataObjectTest::testDumpTriggersNoDeprecations()dumps an object with nested objects (one of them twice) and aDataSet, and collectsE_DEPRECATEDnotices. On PHP 8.5 it fails before the change (notices fromattach()/contains()) and passes after; on PHP 8.3/8.4 it passes either way. Run e.g.php8.5 vendor/bin/phpunit --filter testDumpTriggersNoDeprecations.Documentation Changes Required
None (no behaviour change).
🤖 Generated with Claude Code