Skip to content

T17005 config cast#17010

Merged
niden merged 6 commits into
5.0.xfrom
T17005-config-cast
May 14, 2026
Merged

T17005 config cast#17010
niden merged 6 commits into
5.0.xfrom
T17005-config-cast

Conversation

@niden
Copy link
Copy Markdown
Member

@niden niden commented May 13, 2026

Hello!

In raising this pull request, I confirm the following:

  • I have read and understood the Contributing Guidelines
  • I have checked that another pull request for this purpose does not exist
  • I wrote some tests for this PR
  • I have updated the relevant CHANGELOG
  • I have created a PR for the documentation about this change

Fixed Phalcon\Support\Collection::get() returning the wrapping object's mangled property table when called with $cast = 'array' on a stored object (e.g. a nested Phalcon\Config\Config, which Config::setData() wraps around every array value). The previous implementation called settype($value, 'array') unconditionally, which on an object exposes PHP's null-prefixed internal protected-property names ("\0*\0data", "\0*\0lowerKeys", etc.) instead of the intended array form, so $config->get('outKey', [], 'array')['inKey'] raised Notice: Undefined index. The cast branch now special-cases 'array' for objects exposing a toArray() method and delegates to that method; scalar casts (int, bool, float, string, null, object) and 'array' on a plain stdClass (no toArray()) are unchanged

Thanks

@niden niden requested a review from Jeckerson May 13, 2026 16:39
@niden niden self-assigned this May 13, 2026
@niden niden added bug A bug report status: medium Medium 5.0 The issues we want to solve in the 5.0 release labels May 13, 2026
@niden niden changed the base branch from 5.0.x to T17000-collection-revamp May 13, 2026 17:05
Base automatically changed from T17000-collection-revamp to 5.0.x May 14, 2026 14:41
@niden niden merged commit a950d9d into 5.0.x May 14, 2026
189 of 190 checks passed
@niden niden deleted the T17005-config-cast branch May 14, 2026 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.0 The issues we want to solve in the 5.0 release bug A bug report status: medium Medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant