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