-1

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.

1
  • See stackoverflow.com/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. Commented Nov 16, 2018 at 22:35

2 Answers 2

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.net/manual/en/languag

1

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'];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.