FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix null model result array keys by robinsowell · Pull Request #5334 · ExpressionEngine/ExpressionEngine · GitHub

Fix null model result array keys - #5334

Open
robinsowell wants to merge 2 commits into
7.devfrom
bugfix/php-85-query-error
Open

Fix null model result array keys#5334
robinsowell wants to merge 2 commits into
7.devfrom
bugfix/php-85-query-error

Conversation

robinsowell commented Jun 25, 2026
edited
Loading

Copy link
Copy Markdown
Contributor

Front end load error that shows for several line numbers:

Deprecated Using null as an array offset is deprecated, use an empty string instead ee/ExpressionEngine/Service/Model/Query/Result.php, line 126

This is the absolute minimal fix for a PHP 8.5 deprecation notice in model query result hydration and should preserve existing behavior from older php versions. BUT it's probably not the best fix. The best fix is likely #5337

But for a short term fix, someone can plop this change in and ditch the warnings and have the behavior the same as before.

details....

The warning can occur in ExpressionEngine\Service\Model\Query\Result when a hydrated model has a null primary key value and that value is used as an array key.

The more semantic fix would be to skip hydrating empty related models from LEFT JOIN results when the joined model’s primary key is NULL. That would better represent “no related model exists.”

However, relationship hydration is sensitive, and changing that behavior could affect how model results are assembled in edge cases.

This PR takes the safer, minimal approach: it preserves PHP’s historical behavior by explicitly normalizing null array keys to an empty string before using them as offsets. This avoids the PHP 8.5 deprecation without changing the broader result hydration flow.

robinsowell added the Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. label Jun 25, 2026
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

Labels

Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL