woocommerce / storefront

Official theme for WooCommerce
https://wordpress.org/themes/storefront/
960 stars 472 forks source link

Prevent infinite loop on prev/next product navigation #2054

Closed chrono-meter closed 1 year ago

chrono-meter commented 1 year ago

Fixes #2053. Storefront_WooCommerce_Adjacent_Products::get_product() has no execution time limit. So it may take huge execution time or enter infinite loop.

In my environment, it causes by Simple Custom Post Order ( \SCPO_Engine::scporder_previous_post_where() and \SCPO_Engine::scporder_next_post_where()). This is not StoreFront's bug, and it's only occurred in some environments. But it's more better experience by adding infinite loop blocker.

danieldudzic commented 1 year ago

Hi @chrono-meter,

We really appreciate you taking the time and creating this PR.

I'd recommend reporting the issue to the plugin developer so that they can investigate whether there's a way to adjust their code not to cause conflict.

The conditional check added could cause a loop break out too early meaning there may be valid adjacent products that won't be surfaced.

Also, there is still an investment of time needed by our team to consider the impact of merging your PR to Storefront. Because at this time, your pull request does not fall into one of the criteria "buckets", we will go ahead and close it.