A forever loop can happen when amazon-s3-and-cloudfront conflicts with the a8c-files code
Expected/Desired Behavior
- A filter loop causing out of memory fatal error never happens
Actual Behavior
In at least one instance, with version 2.6dev of amazon-s3-and-cloudfront, an endless loop occurs... calling https://github.com/Automattic/vip-go-mu-plugins/blob/82308873535a775d263daa3f2cc24a36d8774ccd/a8c-files.php#L704 multiple times until memory is exceeded. Stack traces can be enormous.
Steps to Reproduce the Problem
- Install the amazon-s3-and-cloudfront plugin version
- Monitor CLI tasks.
- Get wp-content/plugins/amazon-s3-and-cloudfront/classes/amazon-s3-and-cloudfront.php:3330 plugins_url() to be called (normally, this will happen during the init hook)
Additional notes
It seems keeping a static variable for the uploads URL in https://github.com/Automattic/vip-go-mu-plugins/blob/82308873535a775d263daa3f2cc24a36d8774ccd/a8c-files.php#L704 (to avoid calling get_site_url again) may circumvent the loop.
Example stack trace (partial)
wp-content/plugins/amazon-s3-and-cloudfront/classes/as3cf-filter.php:954 wp_upload_dir(),
wp-content/plugins/amazon-s3-and-cloudfront/classes/filters/as3cf-local-to-s3.php:122 AS3CF_Filter->get_bare_upload_base_urls(),
wp-content/plugins/amazon-s3-and-cloudfront/classes/filters/as3cf-local-to-s3.php:349 AS3CF_Local_To_S3->url_needs_replacing(),
wp-includes/class-wp-hook.php:287 AS3CF_Local_To_S3->set_url_scheme(),
wp-includes/plugin.php:212 WP_Hook->apply_filters(),
wp-includes/link-template.php:3694 apply_filters('set_url_scheme'),
wp-includes/link-template.php:3284 set_url_scheme(),
wp-content/mu-plugins/a8c-files.php:704 get_site_url(),
wp-includes/class-wp-hook.php:287 A8C_Files->upload_url_path(),
wp-includes/plugin.php:212 WP_Hook->apply_filters(),
wp-includes/option.php:179 apply_filters('option_upload_url_path'),
wp-includes/functions.php:2367 get_option(),
wp-includes/functions.php:2297 _wp_upload_dir(),
wp-content/plugins/amazon-s3-and-cloudfront/classes/as3cf-filter.php:954 wp_upload_dir(),
wp-content/plugins/amazon-s3-and-cloudfront/classes/filters/as3cf-local-to-s3.php:122 AS3CF_Filter->get_bare_upload_base_urls(),
wp-content/plugins/amazon-s3-and-cloudfront/classes/filters/as3cf-local-to-s3.php:349 AS3CF_Local_To_S3->url_needs_replacing(),
wp-includes/class-wp-hook.php:287 AS3CF_Local_To_S3->set_url_scheme(),
wp-includes/plugin.php:212 WP_Hook->apply_filters(),
wp-includes/link-template.php:3694 apply_filters('set_url_scheme'),
wp-includes/link-template.php:3431 set_url_scheme(),
wp-content/plugins/amazon-s3-and-cloudfront/classes/amazon-s3-and-cloudfront.php:3330 plugins_url(),
wp-content/plugins/amazon-s3-and-cloudfront/classes/amazon-s3-and-cloudfront.php:261 Amazon_S3_And_CloudFront->register_modal_assets(),
The loop appears to be:
plugins_url() -> set_url_scheme() -> apply_filters('set_url_scheme') ->
wp_upload_dir() -> apply_filters('option_upload_url_path') -> A8C_Files->upload_url_path() ->
get_site_url() -> set_url_scheme() -> (repeat, etc)
This issue has been marked stale because it has been open for 60 days with no activity. If there is no activity within 7 days, it will be closed.
This is an automation to keep issues manageable and actionable and is not a comment on the quality of this issue nor on the work done so far. Closed issues are still valuable to the project and are available to be searched.