WC_Cart::get_cart_url is deprecated since version 2.5 - php

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.

Related

How to attach stack trace to error log messages in PHP?

I run multiple WordPress sites which have multiple themes and plugins from multiple different authors. I always check my error log and try to contact the authors to fix bugs in their code, but a lot of them are logged as something like:
PHP Deprecated: wpmu_new_blog is <strong>deprecated</strong> since version 5.1.0! Use wp_insert_site instead. in /wp-includes/functions.php on line 5148
PHP Warning: array_merge(): Argument #3 is not an array in /wp-includes/class-wp-customize-widgets.php on line 376
PHP Warning: Error while sending QUERY packet. PID=23688 in /wp-includes/wp-db.php on line 2033
PHP Warning: mysqli_real_connect(): (HY000/2002): No such file or directory in /wp-includes/wp-db.php on line 1635
As you can see, the warnings occurred in files inside wp-include, which are available to all plugin/theme/core authors, so there is no way for me to find out who called the deprecated function, passed the wrong function parameters or whatever they did.
I also cannot easily reproduce the error in a dev environment because I don't know what action triggered it.
Everything would be much easier if I could change some PHP (or even server) setting that would cause a stack trace to be appended to each error log message.
This is one of those things that, as common as my problem probably is, Google is unhelpful because all search results try to explain how to append the stack trace to my own code, not to anyone's code.
You could install the Xdebug extension to PHP, which overrides the error logging mechanism of PHP and adds stack traces to errors, warnings, etc. when enabled. See Xdebug documentation.

How to resolve PHP Warning: Use of undefined constant userid

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.

WordPress 500 Internal Server Error when saving menu in nav-menus.php

I can't save the header menu on my site in WordPress - it keeps failing with a 500 Internal Server Error. I've tried updating my .htaccess file, and the php memory limit has been set to 128M. The core files are recently updated (4.8), and everything else in the site saves fine (pages, other menus, ext.) It's just the header menu (which has 60+ items) that gets the error.
EDIT
The debug log after trying to save the menu contains no fatal errors. Lots of PHP Notices for deprecated stuff though. Here's a sample:
[16-Aug-2017 17:23:21 UTC] PHP Notice: Undefined variable: th_query in /var/www/vhosts/mysite.com/mysubsite.com/wp-content/themes/mysitetheme/functions.php on line 377
[16-Aug-2017 17:23:21 UTC] PHP Notice: Trying to get property of non-object in /var/www/vhosts/mysite.com/mysubsite.com/wp-content/themes/mysitetheme/functions.php on line 377
[16-Aug-2017 17:23:23 UTC] PHP Notice: The called constructor method for WP_Widget in WDG_SpecialRecentPostsPro is <strong>deprecated</strong> since version 4.3.0! Use <pre>__construct()</pre> instead. in /var/www/vhosts/mysite.com/mysubsite.com/wp-includes/functions.php on line 3894
[16-Aug-2017 17:30:27 UTC] PHP Notice: Use of undefined constant url - assumed 'url' in /var/www/vhosts/mysite.com/mysubsite.com/wp-content/themes/mysitetheme/header.php on line 339
The 500 error still only shows up when trying to save the header menu in Appearance > Menus.
I found this article with similar issue:
WordPress is not limiting the number of menus you can have. Your web
hosting server is.There are limitations on the POST max variables which is limiting the
large number of entries being saved.
So try to increase the following PHP settings in php.ini to something like shown below:
post.max_vars = 5000
request.max_vars = 5000

Error in MenuHelper after copying htdocs folder to other server

I just copied my htdocs folder to anther pc with a clean new xampp and made a copy of the database too. When i try to access the site the php error log shows this error:
[13-Jun-2014 18:34:07 Europe/Berlin] PHP Warning: array_merge() [http://php.net/function.array-merge'>function.array-merge]: Argument #1 is not an array in C:\xampp\htdocs\website\View\Helper\MenuHelper.php on line 74
[13-Jun-2014 18:34:07 Europe/Berlin] PHP Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\website\View\Helper\MenuHelper.php on line 85
My other page which was in the same htdocs folder is running fine (it isn't using cakephp). Any ideas what could have happened? Any idea how to find out where this is called since it seems to be a cakephp-Helper?
EDIT:
Seems I missed 2 lines in the php_error.log:
PHP Notice: Undefined variable: login in C:\xampp\htdocs\website\View\Layouts\default.ctp on line 2
PHP Notice: Undefined variable: menu in C:\xampp\htdocs\website\View\Layouts\default.ctp on line 82
some see me the same, that's what I did, just copy the folder app, after creates a new project and copy the app folder and replaces the app folder. and shuld be found. I look the reason of the problem and just read about the cookies and cache. And the option that a give you is more easy.
The problem was that I was using a new version of xampp but did not update cakephp to the newest version. After doing so everything worked fine.

Tried to Move a WordPress site now I get these weird errors

I moved a wordpress site from a shared environment to a dedicated virtual server on media temple. I got a blank page at first, but I'm getting these weird errors when I turn error reporting on.
How do I fix it?
Site URL: https://64.207.147.116/
Error Messages
Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/herondance.org/httpdocs/wp-settings.php on line 219 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/herondance.org/httpdocs/wp-settings.php on line 234 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/herondance.org/httpdocs/wp-settings.php on line 241 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/herondance.org/httpdocs/wp-settings.php on line 248 Deprecated: Assigning the return value of new by reference is deprecated in /var/www/vhosts/herondance.org/httpdocs/wp-settings.php on line 273 Deprecated: Function set_magic_quotes_runtime() is deprecated in /var/www/vhosts/herondance.org/httpdocs/wp-settings.php on line 27 Notice: Undefined variable: wp_version in /var/www/vhosts/herondance.org/httpdocs/wp-content/plugins/1-click-retweetsharelike/la-click-and-share-utility-fns.php on line 4 Notice: Undefined index: PATH_INFO in /var/www/vhosts/herondance.org/httpdocs/wp-content/plugins/blip-slideshow/blip.php on line 723 Notice: register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. (This message was added in version 3.1.) in /var/www/vhosts/herondance.org/httpdocs/wp-includes/functions.php on line 3422
Check what version of WordPress and PHP you are using. It looks like you might be using a really old version of WordPress that uses features of PHP that are no longer supported. If that is the case I would recommend upgrading WordPress to the latest version.
A stop gap measure would be to disable these warnings by putting the following line of code at the beginning of the index.php file in your web root.
error_reporting(E_ALL & ~E_DEPRECATED);
This will prevent those messages from being displayed, but you really shouldn't ignore them.
Solution: I went into the database with phpmyadmin and disabled all plugins. I then installed them one by one in the backend and presto. Live, working site. Thanks for all the responses though.

Categories