I know this question has been asked a kazillion times, but I've read the responses and done all suggestions. My phpinfo shows:
display_errors = off
error_reporting = 0
and I've set all of the suggestions in my config file, e.g.
define('WP_DEBUG', false);
define('WP_DEBUG_DISPLAY', false);
and yet I'm STILL getting warnings like the following:
Warning: Parameter 1 to wp_default_scripts() expected to be a reference, value given in /Users/.../wp-includes/plugin.php on line 601
Warning: Parameter 1 to wp_default_styles() expected to be a reference, value given in /Users/.../wp-includes/plugin.php on line 601
Please note, I'm using MAMP for a local server and wordpress. Also I've searched the entire site to see if WP_DEBUG is being set elsewhere and it's not.
I'm banging my head against a wall. Any ideas?
Thanks,
Heather
Which version of php and Wordpress are you running? There are several posts in the wordpress core tracker pointing similar issues with php 7.1:
https://core.trac.wordpress.org/ticket/38144
https://core.trac.wordpress.org/ticket/37772
Regarding why is WP showing this warnings although you have disabled all debug options here are some suggestions:
Search in your php.ini for something like this and comment it:
error_reporting = E_ALL & ~E_NOTICE
error_reporting = E_ALL & ~E_NOTICE | E_STRICT
error_reporting = E_COMPILE_ERROR|E_RECOVERABLE_ERROR|E_ER… _ERROR
error_reporting = E_ALL & ~E_NOTICE
Search your code for error_reporting(whatever) or ini_set('error_reporting', whatever);
Hope this helps.
Related
So I have disabled PHP Errors inside my php.ini file (/etc/php5/apache2/php.ini) but they still continue to show in browser. I am running PHP version 5.5.9-1ubuntu4.13 and to do this I used the following:
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE & ~E_WARNING
display_errors = Off
display_startup_errors = Off
Examples of errors still showing include:
Warning: Creating default object from empty value ...
and
Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in ...
Any help/advice as to why these errors may still be showing would be greatly appreciated. Thanks!
So I finally figured this out, with the help of Ukavi in the comments.
The errors started to display after I had transferred the site from one server to another, and it appears that the first server ran an older version of PHP which is why they did not show up before.
Anyway, the fix. I added this to wp-config.php:
error_reporting(0);
ini_set('display_errors', 'off');
I also did a find in files for ini_set and found a few instances where they had been deliberately activated. As this site is not a solo project I wasn't aware of this!
Thank you for all the advice guys.
I am working on project # home and using WAMP for development. Currently the php.ini file has the following lines set like this:
error_reporting = E_ALL & ~E_DEPRECATED
display_errors = On
I had hoped in doing so it would prevent deprecation warnings from showing up. However it is not. Is there a way I can adjust error_reporting to ignore deprecated warnings.
Output I am getting currently:
You can use this function :
error_reporting(E_ALL ^ E_DEPRECATED);
http://www.php.net/manual/en/function.error-reporting.php
Or use "#" operator before function name.
#mysql_connect();
In your php.ini file change the following.. (note wamp has 2 different php.ini files so make the changes on both)
from this
error_reporting = E_ALL
to this
error_reporting = E_ALL & ~E_DEPRECATED
I had the same problem. It turned out however, that I edited wrong php.ini file. In my case the correct one was
C:\wamp64\bin\php\php5.6.25\phpForApache.ini
and in this file I have changed this line to:
error_reporting = E_ALL & ~E_DEPRECATED.
It didn't make any difference what I had changed in that "obvious" php.ini file.
Set your error report to
error_reporting (E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
on your php page.
If you want to show all errors except deprecated, then use this setting:
error_reporting = E_ALL ^ E_DEPRECATED
Edit: You could also create a custom error handler to hide only mysql_ deprecation warnings:
set_error_handler(function($errno, $errstr) {
return strpos($errstr, 'mysql_') === 0;
}, E_DEPRECATED);
But please note that mysql_ functions are deprecated. So instead of trying to hide the errors, consider switching to mysqli or PDO.
To hide php errors on WAMP server, Please open php.ini file and find following line of code
error_reporting = E_ALL
and replace it with
error_reporting = E_ALL & ~E_NOTICE
All errors will be hide/disable.
I just installed xampp, getting errors all over the place. Want to get rid of error handling. It's only annoying errors to do with my variables.
I'm not sure where to find php.ini, it doesn't exist in my C:\xampp\apache
Inside your php.ini make sure that you have display_errors to Off. From what I understand if you set display_errors to Off then the error_reporting directive doesn't need to change.
Example:
error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
display_errors = Off
in php.ini, do the following change,
display_errors = Off
This is very old now, but in case someone comes across this there's a XAMMP issue with version 5.6.3. I had the same issue with error display set to 'off' and it was still showing up as on in phpinfo()
For some reason, they added the error reporting in php.ini twice. display_errors shows on line 99 of php.ini, and then again on line 552.
So if you scroll down and disable the first one, the second one is still set to 'on' and overrides the first one leaving error reporting active.
I'm sure this will be fixed with future versions of XAMMP, but wanted to add this here for anyone that comes here looking for an answer to this problem.
If you set display_errors=off then all types of error will of.
But if you only want to notice error off the you can set
error_reporting = E_ALL & ~E_NOTICE
Xampp and other web applications have an error interface to show programmers (and users) execution errors or warnings (notices).
In order to modify the way Xampp shows errors you have to go control panel and open php.ini.
Inside this file you can find two points to modify the way it shows errors:
“display_errors = On”. From my point of view it has to be On all the time. If you put Off you won’t have any info regarding bad sentences.
“error_reporting=E_ALL”. This is the key point. Changing the value of it you can change the way it shows errors.
Inside php.ini is documented all options. My favorites:
error_reporting=E_ALL it shows everything. Good for debug.
error_reporting=E_ALL & ~E_STRICT & ~E_DEPRECATED it shows errors & notice (very important for debugging) and not shows suggestions & deprecated functions in next php versions.
error_reporting=E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED production environment not including Notices.
I hope this fit for you.
More details https://community.apachefriends.org/f/viewtopic.php?f=17&t=50989
I'm trying to get the warnings to show in my php error log.
My ISP has some warnings showing and I need to be able to see them on my test server.
error_reporting = E_ALL & ~E_NOTICE
display_errors = off
display_startup_errors = Off
log_errors = On
error_log = "C:\php-errors.txt"
I've upgraded my php version too 5.2.17
I also have
register_globals = Off
Like my ISP, but I can't get any warnings to show.
ini_set('display_errors', 'on'); is a great way to change php configurations settings specific for that page only. Include it in a global header/initialization file to make it application specific. Also, as mentioned before error_reporting(E_ALL); is good for this too.
Code at the top your scripts:
ini_set('display_errors', 'on');
error_reporting(E_ALL);
Be sure to use these only for development environments only.
Set display_errors to On to display the warnings in the page (instead of in the logfile) and set error_reporting to E_ALL | E_STRICT to display all warnings and errors in your php.ini.
If you want to show all possible warnings, try error_reporting(-1);, or you can put error_reporting = -1 into the php.ini file on your test server. It works, because the internal variable is used as a bit-field, and -1 sets all the bits on, hence, showing all possible errors.
To make sure that the error_reporting is still set to what you think, the variable returns the currently set level.
$prevErrLevel = error_reporting(-1);
echo "errlevel was: $prevErrLevel before setting to all.", __FILE__,':',__LINE__;
I am migrating from PHP4 to PHP5
I have this in my .htaccess:
php_flag display_errors on
php_value error_reporting 2039
Which used to show all errors.
I am still getting some errors but I used to get an error when I called a function that was not defined, but now it stops where it is at and send the client everything up to the error and nothing after. With no error message.
Here is what phpinfo is telling me:
Directive Local Value Master Value
display_errors On Off
error_reporting 2039 6143
I would like to be able to see my error messages for trouble shooting purposes.
Can someone tell me what I need to do? Thanks!!
If everything fails, just put this code at the beginning of your (/of each) script:
error_reporting(E_ALL);
ini_set('display_errors', 1);
This should show you all messages:
ini_set('display_errors', true);
error_reporting(E_ALL);
I'd guess that you PHP 5 version is >= PHP 5.2.0 and that the original error reporting level was E_ALL & ~E_NOTICE (or E_ALL ^ E_NOTICE, both have the same result).
Prior to PHP 5.2.0 E_ALL had a value of 2047, so your error level was 2039 due to not including the E_NOTICE level (of 8). As of PHP 5.2.0 E_ALL changed to 6143 (and as of PHP 5.3.0 to 30719) which means E_ALL & ~E_NOTICE is no longer 2039, but rather 6135 (or 30711 in PHP 5.3).
As for not displaying the errors (calling an undefined function should be a fatal error!), see the other answers.