Skip to content
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

Conflict with Yoast SEO and ATF feature #6751

Open
adumont-tokilab opened this issue Jun 28, 2024 · 1 comment
Open

Conflict with Yoast SEO and ATF feature #6751

adumont-tokilab opened this issue Jun 28, 2024 · 1 comment
Labels
3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting module: OCI Optimize Critical Images priority: low Issues that can wait severity: minor Defect that does not affect functionality

Comments

@adumont-tokilab
Copy link

Describe the bug
A notice is thrown when saving a post when Yoast is installed and if that post exists in the "wpr_above_the_fold" table. In fact, WordPress calls the method "clean_post_cache" once on save. WP-Rocket cleans the URL of that post from the "wpr_above_the_fold" table. Later on, Yoast also calls "clean_post_cache", which triggers the same hook that WP-Rocket uses but fails because the database entry doesn't exists anymore. WP-Rocket caches the database results. The first time they are used, it is okay but the second time, it returns an array of elements but those elements equals "false".

Notice: Trying to get property 'id' of non-object in /web/app/plugins/wp-rocket/inc/Engine/Common/Database/Queries/AbstractQuery.php on line 402

public function delete_by_url( string $url ) {
	if ( ! self::$table_exists && ! $this->table_exists() ) {
		return false;
	}

	$items = $this->get_rows_by_url( $url ); // <-- Returns an array of "false" elements

	if ( ! $items ) {
		return false;
	}

	$deleted = true;
	foreach ( $items as $item ) {
		$deleted = $deleted && $this->delete_item( $item->id );
	}

	return $deleted;
}

To Reproduce
Steps to reproduce the behavior:

  1. Development mode must be activated and/or errors must be displayed.
  2. WP-Rocket 3.16 or newer must be installed.
  3. Yoast SEO must be installed.
  4. Edit a post in the backend. Make sure that post appears in the "wpr_above_the_fold" table.
  5. Save that post.
  6. See error.

Expected behavior
The post should be saved without throwing a notice.

@benorfaz benorfaz added lcp module: OCI Optimize Critical Images 3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting labels Jun 28, 2024
@piotrbak piotrbak added priority: low Issues that can wait and removed lcp labels Jul 17, 2024
@alfonso100
Copy link
Contributor

alfonso100 commented Jul 29, 2024

Two additional Cases

Could not be only related to Yoast, but also to other 3rd parties calling clean_post_cache

https://secure.helpscout.net/conversation/2656511889/503466 (not using Yoast)
https://secure.helpscout.net/conversation/2661231689/504375

related slack thread with more details:
https://wp-media.slack.com/archives/C43T1AYMQ/p1721925394744229

@benorfaz benorfaz added the severity: minor Defect that does not affect functionality label Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3rd party compatibility Issues related to 3rd party compatibility like theme, plugin or hosting module: OCI Optimize Critical Images priority: low Issues that can wait severity: minor Defect that does not affect functionality
Projects
None yet
Development

No branches or pull requests

4 participants