Skip to content

Conversation

danielbachhuber
Copy link
Member

WordPress 6.4 added some memoization that impacts get_template_directory() and get_stylesheet_directory(). Fortunately, we only need to noop the global to fix --skip-themes.

Fixes #5839

WordPress 6.4 added some memoization that impacts
`get_template_directory()` and `get_stylesheet_directory()`.
Fortunately, we only need to noop the global to fix `--skip-themes`.
@danielbachhuber danielbachhuber added this to the 2.9.0 milestone Sep 29, 2023
@danielbachhuber danielbachhuber requested a review from a team as a code owner September 29, 2023 14:27
@danielbachhuber danielbachhuber self-assigned this Sep 29, 2023
Copy link
Member

@swissspidy swissspidy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the rm necessary?

@danielbachhuber
Copy link
Member Author

Is the rm necessary?

@swissspidy Yeah. It prevents this fatal when twentytwentyfour is active on WordPress 5.8, which doesn't yet have wp_enqueue_block_style():

 001 Scenario: Composer stack with Requests v1                                                                    # features/requests.feature:3
      When I run `vendor/bin/wp eval 'var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );'` # features/requests.feature:35
        $ vendor/bin/wp eval 'var_dump( \WP_CLI\Utils\http_request( "GET", "https://example.com/" ) );'
        
        PHP Fatal error:  Uncaught Error: Call to undefined function wp_enqueue_block_style() in /tmp/wp-cli-test-run--6516e1c6164d62.69050688/wp-content/themes/twentytwentyfour/functions.php:32
        Stack trace:

Because the test doesn't have anything to do with theme loading, I think it's fine to simply remove them.

@danielbachhuber danielbachhuber merged commit 70c20e7 into main Sep 29, 2023
@danielbachhuber danielbachhuber deleted the fix-skip-themes-wordpress-6-4 branch September 29, 2023 15:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--skip-themes is broken for WordPress trunk
2 participants