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 Rest API "posts" endpoint shows deprecated messages while WP_DEBUG True #13

Open
jeflopodev opened this issue Sep 23, 2024 · 1 comment
Milestone

Comments

@jeflopodev
Copy link

jeflopodev commented Sep 23, 2024

I was trying to use WP with AstroJs using the Rest API posts endpoint http://<domain>/wp-json/wp/v2/posts

Since I had define( 'WP_DEBUG', true );

I'm getting this as part of the output:

<br />
<b>Deprecated</b>:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in <b>C:\laragon\www\latest\wp-content\plugins\enhanced-embed-block-main\enhanced-embed-block.php</b> on line <b>178</b><br />
<br />
<b>Deprecated</b>:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in <b>C:\laragon\www\latest\wp-content\plugins\enhanced-embed-block-main\enhanced-embed-block.php</b> on line <b>178</b><br />
<br />
<b>Deprecated</b>:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in <b>C:\laragon\www\latest\wp-content\plugins\enhanced-embed-block-main\enhanced-embed-block.php</b> on line <b>178</b><br />
<br />
<b>Deprecated</b>:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in <b>C:\laragon\www\latest\wp-content\plugins\enhanced-embed-block-main\enhanced-embed-block.php</b> on line <b>178</b><br />
<br />
<b>Deprecated</b>:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in <b>C:\laragon\www\latest\wp-content\plugins\enhanced-embed-block-main\enhanced-embed-block.php</b> on line <b>178</b><br />
<br />
<b>Deprecated</b>:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in <b>C:\laragon\www\latest\wp-content\plugins\enhanced-embed-block-main\enhanced-embed-block.php</b> on line <b>178</b><br />
<br />
<b>Deprecated</b>:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in <b>C:\laragon\www\latest\wp-content\plugins\enhanced-embed-block-main\enhanced-embed-block.php</b> on line <b>178</b><br />
<br />
<b>Deprecated</b>:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in <b>C:\laragon\www\latest\wp-content\plugins\enhanced-embed-block-main\enhanced-embed-block.php</b> on line <b>178</b><br />
<br />
<b>Deprecated</b>:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in <b>C:\laragon\www\latest\wp-content\plugins\enhanced-embed-block-main\enhanced-embed-block.php</b> on line <b>178</b><br />
<br />
<b>Deprecated</b>:  parse_str(): Passing null to parameter #1 ($string) of type string is deprecated in <b>C:\laragon\www\latest\wp-content\plugins\enhanced-embed-block-main\enhanced-embed-block.php</b> on line <b>178</b><br />
...

Seems that the first parameter has a null value and parse_str() doesn't like that since it expects a string, or maybe there's no result and since it's mandatory as of php 8.0.0 it fails, or both I don't know 😅

Just sharing, in case you find it useful in any way.

@mrwweb
Copy link
Owner

mrwweb commented Sep 23, 2024

Thanks for the report, @jeflopodev. I can see why this would end up happening. In fact, I'm a little surprised I didn't catch this one myself. I'll try to get an update out sooner than later.

This is untested, but if you need an immediate fix, I suspect you can replace line 178 with:

if( $params ) {
	parse_str( $params, $query );
}

@mrwweb mrwweb modified the milestones: v1.1.0, v1.2.0 Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants