fix: using null as an array offset is deprecated#5331
Open
sreichel wants to merge 1 commit intoOpenMage:mainfrom
Open
fix: using null as an array offset is deprecated#5331sreichel wants to merge 1 commit intoOpenMage:mainfrom
sreichel wants to merge 1 commit intoOpenMage:mainfrom
Conversation
PHP Deprecated: Using null as an array offset is deprecated, use an empty string instead in - app/code/core/Mage/Wishlist/Model/Item.php on line 658 - app/code/core/Mage/Wishlist/Model/Item.php on line 152 - app/code/core/Mage/Wishlist/Model/Item.php on line 153 (https://github.com/OpenMage/magento-lts/actions/runs/23358136437/job/67955409410)
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses PHP 8.1+ deprecation warnings caused by using null as an array offset in the wishlist item option indexing logic.
Changes:
- Normalize wishlist item option codes to strings before using them as keys in
$_optionsByCode. - Normalize
getOptionByCode()input to a string to avoid deprecatednullarray offsets. - Update
Mage_Wishlist_Model_Item_Option::getCode()PHPDoc to reflect possiblenullreturn values.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/code/core/Mage/Wishlist/Model/Item/Option.php | Adjusts PHPDoc for getCode() to allow null, matching observed usage. |
| app/code/core/Mage/Wishlist/Model/Item.php | Casts option codes to string when indexing/looking up options to prevent deprecated null offsets. |
|
addison74
approved these changes
Mar 21, 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
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.



PHP Deprecated: Using null as an array offset is deprecated, use an empty string instead in
(https://github.com/OpenMage/magento-lts/actions/runs/23358136437/job/67955409410)