Problem/Motivation
This module uses array_key_exists() on mixed array/Attribute object in a couple of places.
Using array_key_exists() on objects can be problematic, as described in this core issue: #3090145: Ensure that mixing array and Attribute objects in theme rendering is managed properly.
Also, using array_key_exists() on objects will be deprecated in PHP 8. Visiting /admin/appearance triggers the following deprecation warning:
Deprecated function: array_key_exists(): Using array_key_exists() on objects is deprecated. Use isset() or property_exists() instead in lazy_preprocess_image() (line 238 of modules\contrib\lazy\lazy.module).
lazy_preprocess_image(Array, 'image', Array) (Line: 287)
Steps to reproduce
If using PHP 7.4, you may be able to trigger the warning by visiting the "Appearance" page at /admin/appearance if a custom theme is available.
Proposed resolution
Use AttributeHelper class. Change record: AttributeHelper is introduced to manage mixed array/Attribute object operations
Remaining tasks
User interface changes
None
API changes
None
Data model changes
None
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | lazy-use_attributehelper-3251508-2.patch | 1.32 KB | othermachines |
Comments
Comment #2
othermachines commentedPatch replaces array_key_exists with AttributeHelper class.
Comment #3
osmanI was able to confirm the issue, and the patch works as advertised. Thank you.
Comment #5
osman