-
-
Notifications
You must be signed in to change notification settings - Fork 452
PHP8.5: fix null array offset #5028
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR addresses null array offset deprecation warnings in PHP 8.5 by adding null checks and type coercion before array access operations. The changes prevent potential issues where null values are used as array keys or offsets.
Key Changes:
- Added null checks with empty string fallback before array key access in multiple methods
- Added explicit string type casting for array keys to prevent null offset warnings
- Removed a potentially problematic
curl_close()call that could fail if the resource was already null
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/Varien/Http/Adapter/Curl.php | Removed curl_close call to prevent errors when resource is null |
| lib/Varien/Data/Collection.php | Added null check converting null to empty string before array access |
| app/code/core/Mage/Index/Model/Indexer/Abstract.php | Added null check converting null to empty string before array access |
| app/code/core/Mage/Core/Controller/Varien/Router/Standard.php | Added string cast to prevent null as array key |
| app/code/core/Mage/CatalogInventory/Model/Stock/Status.php | Added string cast to prevent null as array key |
| app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php | Added null check converting null to empty string before array access |
| app/code/core/Mage/Catalog/Model/Product/Type.php | Added string cast to prevent null as array key |
Comments suppressed due to low confidence (1)
app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Price.php:1
- Converting null to empty string will result in a less informative error message on line 319 ('Unsupported product type ""'). Consider checking for null explicitly and throwing a more specific exception like 'Product type ID cannot be null' to aid debugging.
<?php
|



https://github.com/OpenMage/magento-lts/actions/runs/18709139113/job/53353233192