Skip to content

[Bug] Allow purely numeric editable names when saving documents - #2087

Merged
kingjia90 merged 1 commit into
2026.3from
fix/484-numeric-editable-name
Oct 9, 2026
Merged

kingjia90 merged 1 commit into
2026.3from
fix/484-numeric-editable-name

Conversation

@kingjia90

Copy link
Copy Markdown
Contributor

Problem

Saving a document fails with a TypeError when one of its editables has a purely numeric name (e.g. 123):

setRawEditable(): Argument #1 ($name) must be of type string, int given

Root cause

AbstractPageSnippetAdapter::setEditableData() iterates foreach ($editableData as $name => $value). PHP turns numeric-string array keys into ints, and PageSnippet::setRawEditable(string $name, …) rejects them under strict_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 only setRawEditable() call in the bundle.

Tests

tests/Unit/Document/Data/Adapter/PageAdapterTest.php saves editables keyed '123' and 'headline' through PageAdapter::setData(): fails on 2026.3 with the TypeError above, passes with the fix.

Fixes pimcore/platform-version#484

🤖 Generated with Claude Code

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>
Copilot AI balanced review requested due to automatic review settings October 9, 2026 11:39
@kingjia90 kingjia90 self-assigned this Oct 9, 2026
@kingjia90 kingjia90 added this to the 2026.3.2 milestone Oct 9, 2026
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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.

@kingjia90
kingjia90 merged commit a236a1d into 2026.3 Oct 9, 2026
21 of 23 checks passed
@kingjia90
kingjia90 deleted the fix/484-numeric-editable-name branch October 9, 2026 12:22
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants