Make WordPress Core

Opened 13 months ago

Closed 12 months ago

Last modified 6 months ago

#64142 closed defect (bug) (invalid)

Transients inconsistency since 6.9-beta1

Reported by: nico23 Owned by:
Priority: normal Milestone:
Component: Cache API Version:
Severity: normal Keywords: reporter-feedback close
Cc: Focuses: tests

Description

I always have my GitHub actions run against the latest WP beta and RC version and since 4.9-beta1 this test fails:

​https://github.com/nextgenthemes/advanced-responsive-video-embedder/blob/master/tests/tests-admin-fn-admin.php

1) Nextgenthemes\ARVE\Tests_Admin::test_transient_deletion
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Deleted 2 transients.'
+'Deleted 1 transients.'

The function is here: ​https://github.com/nextgenthemes/advanced-responsive-video-embedder/blob/master/php/fn-cache.php#L171

Always passed the tests with every older WP version I tested this.

Attachments (1)

64142.php​ (2.3 KB ) - added by jorbin 13 months ago.

Download all attachments as: .zip

Change History (9)

#1 @Presskopp
13 months ago

You mean 6.9 !?

#2 @jorbin
13 months ago

  • Milestone Awaiting Review → 6.9

Based on the linked automated test, 6.9 seems like what was meant. That said, delete_transients isn't a core function. It looks like it's ​from your plugin.

Have you been running the tests verses trunk? If so, do you know which commit they started failing on.

#3 @nico23
13 months ago

  • Summary Transients not get created or deleted since 4.9-beta → Transients not get created or deleted since 6.9-beta1

Yes, I meant 6.9-beta1.

And I know that function is not core, but something in core changed that made the test fail that all other WP versions tested OK with. The function carefully only selects the transients and uses the native delete_transient to delete them. I see no issue with the code that tested perfectly fine b4.

And yes, just tested against trunk, same issue, as expected.

#4 @nico23
13 months ago

  • Summary Transients not get created or deleted since 6.9-beta1 → Transients inconsistency since 6.9-beta1

Actually, my tests were messed up, I had the expected and actual flipped, fixed it now. The issue is actually that it finds one transient more than expected.

It's the last assertion. There is supposed to be one transient left, but it says it deletes two. So the function trying to select the last transient apparently finds two.

There was 1 failure:

1) Nextgenthemes\ARVE\Tests_Admin::test_transient_deletion
Failed to delete transients with no prefix and no containing string.
Failed asserting that two strings are equal.
--- Expected
+++ Actual
@@ @@
-'Deleted 1 transients.'
+'Deleted 2 transients.'
Last edited 13 months ago by nico23 (previous) (diff)

#5 @jorbin
13 months ago

  • Keywords reporter-feedback close added

@nico23 I recreated your test and function in a standalone file with the hope of running git bisect to find where this may have broken things and it seems to be fixed now. Can you please verify on your end.

Using gitbisect, I was able to find [61076] to be the commit that fixed things. Based on that commit not touching transients and there being one more transient than expected found by the sql query, I think the issue is likely due to the assumption that there are no transients in the DB at the start of your test.

#6 @wildworks
12 months ago

I would like to confirm whether this issue has been fixed in 6.9 Beta3. Are there any steps we can follow to verify this?

#7 @peterwilsoncc
12 months ago

  • Milestone 6.9
  • Resolution → invalid
  • Status new → closed
  • Version trunk

I repeated @jorbin's test using a the ​custom test file in this gist.

Following the changes to hoist styles in #64150 a transient is set by core, wp_core_block_css_files.

As the final assertion in the third party tests will delete all transients, I'm closing this as invalid as the test doesn't account for existing transients.

#8 @nico23
6 months ago

Seems this changed AGAIN. I adjusted my test code for this, now with 7.0-RC2 this adjustment is not needed anymore.

Note: See TracTickets for help on using tickets.