Skip to content

Invalid array for $sources in filter_srcset_attr hook #1002

@Soare-Robert-Daniel

Description

@Soare-Robert-Daniel

Description

The warning reported by the user:

[ PHP Warning: foreach() argument must be of type array|object, bool given in /nas/content/live/intgrtdsrlife/wp-content/plugins/optimole-wp/inc/tag_replacer.php on line 835]

The array check for $sources in filter_srcset_attr was removed in 407e4fe on the premise that the good data is always served correctly.

Step-by-step reproduction instructions

  1. Add a custom filter for the WP hook 'wp_calculate_image_srcset' that returns a non-array value.
  2. Check the logs for warnings

Screenshots, screen recording, code snippet or Help Scout ticket

Help Scout ticket: https://secure.helpscout.net/conversation/3136637806/476060?viewId=2353196

Environment info

No response

Is the issue you are reporting a regression

Yes, this is a regression.

Metadata

Metadata

Labels

bugThis label could be used to identify issues that are caused by a defect in the product.customer reportIndicates the request came from a customer.regressionIssue represents a change in behavior from a previous version that is not intended or desired..

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions