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

wp_is_stream() causing strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated #37298

Open
ablears opened this issue May 9, 2024 · 2 comments
Labels
[Package] Autoloader [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! [Status] Priority Review Triggered The guild in charge of triage has been notified of this issue in Slack Triaged [Type] Bug When a feature is broken and / or not performing as intended

Comments

@ablears
Copy link

ablears commented May 9, 2024

Impacted plugin

Jetpack

Quick summary

PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in wp-includes/functions.php on line 7288
PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in wp-includes/functions.php on line 2187

I added error logging to find where this was coming from:

wp_is_stream called with non-string path by [{"file":"wp-includes/functions.php","line":2180,"function":"wp_is_stream"},{"file":"wp-content/plugins/woocommerce/vendor/jetpack-autoloader/class-path-processor.php","line":73,"function":"wp_normalize_path"}]

Steps to reproduce

Run a WP CLI command like wp site list

A clear and concise description of what you expected to happen.

No depreciated error logs

What actually happened

Error log and console errors (in the case of WP CLI)

Impact

All

Available workarounds?

No but the platform is still usable

Platform (Simple and/or Atomic)

Self-hosted

Logs or notes

Debian GNU/Linux 10 (buster)
PHP 8.1.14
WP-CLI 2.10.0
WordPress 6.5.3
WooCommerce 8.7.0

@ablears ablears added [Type] Bug When a feature is broken and / or not performing as intended Needs triage Ticket needs to be triaged labels May 9, 2024
@github-actions github-actions bot added [Status] Priority Review Triggered The guild in charge of triage has been notified of this issue in Slack [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] High labels May 9, 2024
@jeherve
Copy link
Member

jeherve commented May 9, 2024

This seems related to #37172.

Do you have any other plugins installed on your site at the moment?

@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! Triaged [Pri] Normal and removed Needs triage Ticket needs to be triaged [Pri] High labels May 9, 2024
@anomiex
Copy link
Contributor

anomiex commented May 9, 2024

I added error logging to find where this was coming from:

wp_is_stream called with non-string path by [{"file":"wp-includes/functions.php","line":2180,"function":"wp_is_stream"},{"file":"wp-content/plugins/woocommerce/vendor/jetpack-autoloader/class-path-processor.php","line":73,"function":"wp_normalize_path"}]

Can you do that again but capture all the stack frames instead of only two?

Attempting some static analysis, the line 73 mentioned corresponds to the second line in this code:

public function find_directory_with_autoloader( $file, $directories_to_check ) {
$file = wp_normalize_path( $file );

That find_directory_with_autoloader method is called in three places. The only one that seems at all reasonable to have passed in null is this one. In turn, the only caller of that method that seems likely is here, which in turn suggests you somehow have the active_plugins or active_sitewide_plugins option having a value with a null value for some key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Autoloader [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Pri] Normal [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! [Status] Priority Review Triggered The guild in charge of triage has been notified of this issue in Slack Triaged [Type] Bug When a feature is broken and / or not performing as intended
Projects
Development

No branches or pull requests

3 participants