[wp-trac] [WordPress Trac] #56558: Fatal Error caused by Uncaught TypeError: trim(): Argument #1 ($string) must be of type string, array given in /www/example_website/public/wp-includes/class-wp-query.php:803
WordPress Trac
noreply at wordpress.org
Wed Jul 26 10:19:18 UTC 2023
#56558: Fatal Error caused by Uncaught TypeError: trim(): Argument #1 ($string)
must be of type string, array given in /www/example_website/public/wp-
includes/class-wp-query.php:803
--------------------------+---------------------
Reporter: rlmc | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: 6.4
Component: Query | Version:
Severity: major | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+---------------------
Changes (by SergeyBiryukov):
* keywords: => needs-patch
* milestone: Awaiting Review => 6.4
Old description:
> I found this in my error.log file on my web server. If I paste the same
> url onto my website, it does indeed cause a fatal error. Here is the
> full entry from the error.log file...the only change I made is to
> disguise my website as example.com:
>
> 2022/09/11 01:49:53 [error] 90419#90419: *4359495 FastCGI sent in stderr:
> "PHP message: PHP Fatal error:
> Uncaught TypeError: trim(): Argument #1 ($string) must be of type string,
> array given in /www/example_website/public/wp-includes/class-wp-
> query.php:803
> Stack trace:
> #0 /www/example_website/public/wp-includes/class-wp-query.php(803):
> trim(Array)
> #1 /www/example_website/public/wp-includes/class-wp-query.php(1792):
> WP_Query->parse_query()
> #2 /www/example_website/public/wp-includes/class-wp-query.php(3586):
> WP_Query->get_posts()
> #3 /www/example_website/public/wp-includes/class-wp.php(648):
> WP_Query->query(Array)
> #4 /www/example_website/public/wp-includes/class-wp.php(775):
> WP->query_posts()
> #5 /www/example_website/public/wp-includes/functions.php(1330):
> WP->main('')
> #6 /www/example_website/public/wp-blog-header.php(16): wp()
> #7 /www/example_website/public/index.php(17): require('/www/example...')
> #8 {main}
> thrown in /www/examplewebsite" while reading response header from
> upstream, client: 82.199.155.149, server: www.example.com,
> request: "POST
> /example_page?q=user%2Fpassword&name%5B%23post_render%5D%5B%5D=passthru&name%5B%23type%5D=markup&name%5B%23markup%5D=id
> HTTP/1.1",
> upstream: "fastcgi://unix:/var/run/php8.0-fpm-examplewebsitehhub.sock:",
> host: "www.example.com:61359"
New description:
I found this in my error.log file on my web server. If I paste the same
url onto my website, it does indeed cause a fatal error. Here is the full
entry from the error.log file...the only change I made is to disguise my
website as example.com:
{{{
2022/09/11 01:49:53 [error] 90419#90419: *4359495 FastCGI sent in stderr:
"PHP message: PHP Fatal error:
Uncaught TypeError: trim(): Argument #1 ($string) must be of type string,
array given in /www/example_website/public/wp-includes/class-wp-
query.php:803
Stack trace:
#0 /www/example_website/public/wp-includes/class-wp-query.php(803):
trim(Array)
#1 /www/example_website/public/wp-includes/class-wp-query.php(1792):
WP_Query->parse_query()
#2 /www/example_website/public/wp-includes/class-wp-query.php(3586):
WP_Query->get_posts()
#3 /www/example_website/public/wp-includes/class-wp.php(648):
WP_Query->query(Array)
#4 /www/example_website/public/wp-includes/class-wp.php(775):
WP->query_posts()
#5 /www/example_website/public/wp-includes/functions.php(1330):
WP->main('')
#6 /www/example_website/public/wp-blog-header.php(16): wp()
#7 /www/example_website/public/index.php(17): require('/www/example...')
#8 {main}
thrown in /www/examplewebsite" while reading response header from
upstream, client: 82.199.155.149, server: www.example.com,
request: "POST
/example_page?q=user%2Fpassword&name%5B%23post_render%5D%5B%5D=passthru&name%5B%23type%5D=markup&name%5B%23markup%5D=id
HTTP/1.1",
upstream: "fastcgi://unix:/var/run/php8.0-fpm-examplewebsitehhub.sock:",
host: "www.example.com:61359"
}}}
--
Comment:
Hi there, thanks for the report!
I believe the original issue has been fixed in [53891] / #17737.
It looks like `$q['page']` was not a part of that commit though, and needs
a similar fix as per comment:2.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56558#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list