How to resolve PHP Warning: Use of undefined constant userid - php

I'm running vbulletin with some plugins on my server, and I'm getting a lot of these warnings in my log file, and I can't even figure out how to track down where the problems are occurring.
Here are a few:
PHP Warning: Use of undefined constant onlinestatusphrase - assumed 'onlinestatusphrase' (this will throw an Error in a future version of PHP) in /home/public_html/includes/class_core.php(4684) : eval()'d code on line 6
PHP Warning: Use of undefined constant adv_index - assumed 'adv_index' (this will throw an Error in a future version of PHP) in /home/public_html/global.php(37) : eval()'d code(10) : eval()'d code on line 1
PHP Warning: Use of undefined constant vsachatbox_collapsed_always - assumed 'vsachatbox_collapsed_always' (this will throw an Error in a future version of PHP) in /home/public_html/includes/class_core.php(4684) : eval()'d code on line 36
I'd like to try to fix these errors to stop them from throwing warnings, but I don't even understand how to find the code that is causing the error to begin with.
If I open the files it says the error is in, I can't find those constants anywhere. Even if do a search of every file on my server, I can't find some of them.

Related

Php 7.4 version and unable to access user authorization page

I am using php 7.4. I have a php page called auth1. It requires a username and Password, which in the
past took me into auth3. I started receiving a deprecated error when I was on php 5.4 so I upgraded to
7.4. Now I get the error messages below. Any ideas. Could it be my mysql not compatible
Warning: Use of undefined constant user - assumed 'user' (this will throw an Error in a future version of PHP) in /home/utm/public_html/auth3.php on line 5
Warning: Use of undefined constant password - assumed 'password' (this will throw an Error in a future version of PHP) in /home/utm/public_html/auth3.php on line 5
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /home/utm/public_html/auth3.php:19 Stack trace: #0 {main} thrown in /home/utm/public_html/auth3.php on line 19
welcome to stackoverflow
your first and second lines are not Uncaught error and don't break your php processes
but about your last line it tell you that mysql_connect doesn't exists
because mysql extension and all of mysql_* functions are deprecated as of PHP 5.5 and has been removed as of PHP 7 to up
as the itachi said, and you said an example (mysqli) you should use a new extension between 3 following ways:
MySQLI reference functions Check they here
MySQLI OOP extension Check they here
PDO Extension Check they here
Also you can see this references for install your needs:
PDO Installation
MySQLI Installation
and about your 1st and 2nd lines you could put your codes to let us check, know and solve your problem

Warning: Use of undefined constant register_nav_menu - assumed 'register_nav_menu' (this will throw an Error in a future version of PHP)

Previously i am using PHP 5.6, i wasn't see that problem ever.
But when i am using php 7.3 i saw this problem arise.
I am using latest wordpress version 5.2.3.
when I run my wordpress site in top of the page it shows the message
Warning: Use of undefined constant `register_nav_menu` - assumed `register_nav_menu` (this will throw an Error in a future version of PHP) in `C:\xampp\htdocs\wordpress\newspaper\wp-content\themes\news\functions.php` on line 14
How can i solve this problem?
tipically, this error appear when you make a syntax error.
I assume register_nav_menu is a function. So, I think you forgot the parentheses after register_nav_menu. You should write register_nav_menu().
If it's a variable, you probably forgot $. If it's a string, check your quote.
Without your code, it's really complicated to be more specific.

WC_Cart::get_cart_url is deprecated since version 2.5

I am getting the error in my debug log -
[22-Mar-2019 12:25:33 UTC] PHP Notice: WC_Cart::get_cart_url is <strong>deprecated</strong> since version 2.5! Use wc_get_cart_url instead. in /home/176860.cloudwaysapps.com/tzshvjkjbz/public_html/wp-includes/functions.php on line 4329
What could be causing this error? The line of code specified aove is inside a comment which says:
* A return value of `1` means the file path contains directory traversal.
So I have no idea where to go from this error message. I've also searched my entire directory for WC_Cart::get_cart_url and it is not being used anywhere.

Searching for a comprehensive list with all PHP error messages. Bugtracker

I'm searching for a list will all possible PHP error messages. Google couldn't help me out this time.
Example:
Fatal error: Call to undefined function ... in ... on line ...
Warning: require_once(...) [function.require-once]: failed to open stream: No such file or directory in ... on line ...
Warning: Illegal offset type in ... on line ...
and much more of such erros...
According to the php.net http://php.net/manual/en/tokens.php PHP is using tokens to generate error messages. But i still don't understand how to use them to generate an error message like
Fatal error: Call to undefined function T_SOME_TOKEN in T_SOME_TOKEN on line 666
Where should i search for such an error generator? I assume that it is hidden somewhere in PHP's source code, but i have no idea where to start.
The purpose is to build an PHP error parser which would monitor server error messages (if they are enabled) and check for PHP script updates:
Script "foo.php" which returns multiple errors
Scan 1 (time t1):
PHP Error on line 1000
PHP Error on line 1200
Scan 2 (time t2):
PHP Error on line 1010
PHP Error on line 1210
1010 - 1000 = 10 lines of code were added (somewhere between lines 0 and 1010). By using this approach and knowledge of which bug was fixed at which time it is possible to make kind of "PHP error based black box reverse engineering" of a given PHP script (if there are enough other reproducible PHP bugs in such script) (e.g. buggy game engine).

ereg_replace() is deprecated in PHP 5.4.24 but not 5.5?

I am having the strangest problem.
I wrote a module for WHMCS which is working fine in my WHMCS but not in a client's... We have the exact same setup's (server related) both are cPanel and both versions of WHMCS are the same. The only difference it seems is in the php version.
He is running PHP 5.4.24 and I am running 5.5 when he enters into my main module he gets an intimidate message :
Deprecated: Function ereg_replace() is deprecated in /home/dir/.....:eval()'d code on line 1
When he tried to generate a PDF he gets this error:
Notice: Undefined variable: response in /home/dir.../index.php(1) : eval()'d code(1) : eval()'d code on line 102
I have searched and searched... I cannot find the function or the eval()'d value anywhere in my code. I am not sure at all where this is coming from.
Also, I have checked line 102 and it simply says:
<h3 style="text-align:center"><? echo $response; ?></h3>
Even if the $response variable does not exist it should not give that error should it?
How can I locate where this issue is coming from?
PS:
The code is encrypted, but even when searching the encrypted code I cannot see the function or anything related.
Any assistance would be awesome in resolving this issue :)

Categories