Repository navigation
[Bug] Allow purely numeric editable names when saving documents - #2087
Merged
Merged
Conversation
Editable data is keyed by editable name. When a name is purely numeric (e.g. "123"), PHP turns the array key into an int, and passing it to PageSnippet::setRawEditable(string $name, ...) throws a TypeError under strict_types, so the document cannot be saved. Cast the key back to string before setting the editable. Fixes pimcore/platform-version#484 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Contributor
There was a problem hiding this comment.
🟢 Approved
The root-cause fix is narrowly scoped, covers the only call site, and includes an appropriate regression test.
0 open findings
What changed in this PR
Fixes document saves when editable names are purely numeric.
Changes:
- Casts editable array keys to strings at the
setRawEditable()boundary. - Adds a focused regression test covering numeric and ordinary names.
- Addresses the root cause at the sole bundle call site without API or BC impact.
No unresolved risks were identified; documentation changes are unnecessary for this corrective internal behavior.
| File | Description |
|---|---|
src/Document/Data/Adapter/AbstractPageSnippetAdapter.php |
Normalizes editable names before passing them to Pimcore. |
tests/Unit/Document/Data/Adapter/PageAdapterTest.php |
Verifies numeric editable names save without a TypeError. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.



Problem
Saving a document fails with a TypeError when one of its editables has a purely numeric name (e.g.
123):Root cause
AbstractPageSnippetAdapter::setEditableData()iteratesforeach ($editableData as $name => $value). PHP turns numeric-string array keys into ints, andPageSnippet::setRawEditable(string $name, …)rejects them understrict_types.Fix
Cast the key back to string. Only purely numeric names were affected (
"0123"stays a string key), and the cast restores them exactly. Private method, no BC impact; it's the onlysetRawEditable()call in the bundle.Tests
tests/Unit/Document/Data/Adapter/PageAdapterTest.phpsaves editables keyed'123'and'headline'throughPageAdapter::setData(): fails on2026.3with the TypeError above, passes with the fix.Fixes pimcore/platform-version#484
🤖 Generated with Claude Code