When I tried to edit my menu, it appeared
HTTP ERROR 500
Then I set define('WP_DEBUG', true);
in wp-config.php
Once I try to save the menu, the following error appears:
Notice: Use of undefined constant REQUEST_URI - assumed 'REQUEST_URI' in /www/web/keenker/public_html/wp-content/themes/keenker/functions.php on line 73
The tricky thing is, my line 73 in functions.php is
return trim($title);
And throughout the functions.php file, I don't even have REQUEST_URI
parameters.
Appreciate for any help.
When I tried to edit my menu, it appeared
HTTP ERROR 500
Then I set define('WP_DEBUG', true);
in wp-config.php
Once I try to save the menu, the following error appears:
Notice: Use of undefined constant REQUEST_URI - assumed 'REQUEST_URI' in /www/web/keenker/public_html/wp-content/themes/keenker/functions.php on line 73
The tricky thing is, my line 73 in functions.php is
return trim($title);
And throughout the functions.php file, I don't even have REQUEST_URI
parameters.
Appreciate for any help.
Share Improve this question asked Nov 16, 2018 at 21:27 p onelandp oneland 171 silver badge8 bronze badges 1- See stackoverflow/a/556833/378183 - looks like that PHP notice was occurring regardless of your 500 Error - you're only seeing it now because you turned on WP_DEBUG. The notice and the error are not the same thing. – Isaac Lubow Commented Nov 16, 2018 at 22:35
2 Answers
Reset to default 0*Without quotes PHP interprets the REQUEST_URI
as a constant** but corrects your typo error if there is no such constant and interprets it as string.
When error_reporting
includes E_NOTICE
, you would probably get an error such as:
Notice: Use of undefined constant REQUEST_URI - assumed 'REQUEST_URI' in <file path> on line <line number>
But if there is a constant with this name, PHP will use the constant’s value instead. (See also Array do's and don'ts)
So always use quotes when you mean a string. Otherwise it can have unwanted side effects.
And for the difference of single and double quoted strings, see the [PHP manual about strings](http://docs.php/manual/en/languag
I fixed the issue myself by editing a line in functions.php and it no longer shows the error message for me. The error was:
Warning: Use of undefined constant REQUEST_URI – assumed ‘REQUEST_URI’ (this will throw an Error in a future version of PHP) in /var/www/web33/web/wp-content/themes/slanted-master/functions.php on line 73
So on line 73 in functions.php I changed the line mentioned in the error message to:
$path = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742289480a4415924.html
评论列表(0条)