WordPress.org

Make WordPress Core

Opened 9 days ago

Closed 7 days ago

Last modified 7 days ago

#52566 closed defect (bug) (fixed)

wp_resource_hints() test failures when removing $pagenow global from get_home_url()

Reported by: SergeyBiryukov Owned by: SergeyBiryukov
Milestone: 5.7 Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:

Description

Background: #52421

After [50156], there were two test failures:

1) Tests_WP_Resource_Hints::test_dns_prefetch_scripts_does_not_included_registered_only
Undefined index: pagenow

/var/www/build/wp-includes/functions.wp-scripts.php:272
/var/www/tests/phpunit/tests/general/resourceHints.php:192

2) Tests_WP_Resource_Hints::test_deregistered_scripts_are_ignored
Undefined index: pagenow

/var/www/build/wp-includes/functions.wp-scripts.php:272
/var/www/tests/phpunit/tests/general/resourceHints.php:205

Restoring the $pagenow global in [50164] have fixed them, but it's not quite clear why that happens, as the global is no longer used in the get_home_url() function.

As noted by @peterwilsoncc in comment:9:ticket:52421, this could be either a poorly defined global in source, or erroneously reset global in the tests.

Change History (3)

#1 @SergeyBiryukov
9 days ago

  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

#2 @SergeyBiryukov
7 days ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 50393:

Script Loader: Explicitly declare the $pagenow global in wp_deregister_script().

This avoids an "Undefined index" PHP notice in wp_resource_hints() tests when running the full test suite.

Remove the unused global from get_home_url().

Follow-up to [25443], [38100], [38174], [50156], [50164].

Props peterwilsoncc.
Fixes #52566.

#3 @SergeyBiryukov
7 days ago

  • Milestone changed from 5.8 to 5.7
Note: See TracTickets for help on using tickets.