TL;DR : Upgraded PHP on our server which caused a bunch of Deprecated errors to appear in WordPress, tried a number of fixes but the errors won't go away.
PHP Version: 5.3.10
WordPress Version: 3.3.2
I have a WordPress installation that has been up and running for a little while now, with no complaint.
This week, we upgraded PHP on the server to 5.3.10, after the update, the WordPress Dashboard began filling up with errors like this:
Deprecated: Assigning the return value of new by reference is deprecated in /home/random/public_html/wp-includes/class-simplepie.php on line 738
A large number (I suspect 116) of errors like this (each on a different line) appear in
Incoming Links
WordPress Blog
Plugins
As advised by a number of posts around the WordPress forums, I disabled error reporting both at a file level (by adding error_reporting(0); to the top of wp-config.php and/or other files) and using PHP.ini. Phpinfo confirms that error_reporting = 0.
This had no effect, with the warnings still showing up on the dashboard.
I tried disabling all of my plugins and reverting to the default theme (with a mind to enable each one in turn to see if one of them was causing the issue) but the errors continued to appear.
Next, instead of treating the symptom, I went to see if I could fix the cause of the issue.
Getting deprecated error with Simplepie
and
Assigning the return value of new by reference is deprecated
pointed to class-simplepie.php having some out of date syntax inside.
Using find/replace in my text editor I swapped all 166 instances of
=& new
for
= new
And I am still seeing errors on my dashboard.
So, as far as I can see, there should be no errors to report, and if there were, they shouldn't be showing up anyway.
Wordpress is not running in debug mode.
A paste of my phpinfo can be found here: http://pastebin.com/Pk68sDL1 if it is of any use to anyone.
Not sure what to try next. Any tips much appreciated.
D
try this and u will not have this errors:
error_reporting(0);
ini_set("display_errors", "off");
ini_set("display_startup_errors", "off");
Or set the same directives in your php.ini file in your server.
I was having the exact same problem today and I also tried all of the solutions you listed. Eventually I realized that after I replaced
=& new
with
= new
in class-simplepie.php, I also needed to reload the modules in the dashboard. This doesn't seem to happen when you just refresh the browser page, or even hide the module and then show it again.
So I highlighted the Incoming Links module on the Dashboard and clicked Configure. I changed the RSS feed URL to anything else (google.com), hit Submit, and it worked. Refreshed that module with no more deprecated errors from class-simplepie.php. Did the same for the Wordpress Blog module and that also worked.
The only thing I cannot figure out is how to refresh the Plugins module. It doesn't have a Configure option and I can't get it to reload like the others.
Edit: Plugins module works now as well. Just needed time to reset.
I had these warnings as well. I stumbled across a message by a developer of simplepie that this happens with PHP5.3+ and is related to the compatibility to PHP4. Using simplepie v1.3-dev drops this downwards-compatibility and fixes that.
Download from GitHub
Add this to the top of your wp-config.php file, right after the first
error_reporting(0);
Related
I'm using Joomla 3.8 to manage our community website (on the side pro bono). Everything was going well until I noticed an article with a padlock icon in the administration. I applied Global Check In, which unlocked the article. But now I find that I am unable to add or edit articles. Please see screenshot below:
The website is running on PHP version 5.6.31, with web server Apache.
How do I fix the problem? Is there any code I need to tweek?
This is how I determined the source of the problem. On the administration, I raised the error reporting to maximum:
Global Configuration > Server tab > Error Reporting (changed from System Default to Maximum)
I saw the following errors:
Notice: Undefined variable: plugin in */home5//public_html/plugins/system/connectdaily/connectdaily.php on line 42
Fatal error: Call to a member function logError() on null in /home5//public_html/plugins/system/connectdaily/connectdaily.php on line 42*
I deactivated the connectdaily plugin. The fix worked. I am now able to add and edit articles again.
I am still not sure where the connectdaily plugin is used for. If ever the website will need it, I will just reinstall the plugin.
I have a form that allows upload three files at the same time but just one is required. That works fine, my only problem is the following: if I upload three files I haven't any problem but if I upload one or two files (leaving two or one files empties) I obtain the following notice:
Notice: No file uploaded in Unknown on line 0
As much as empty files. The files are uploaded properly without any other problem, but I want remove that notice... or unless hide it, although I prefer remove it. I tried to hide it using
error_reporting(0);
and
ini_set('display_errors',0);
but neither of two worked...
It is the first time that I have problem, if someone could lead me I'd be very grateful due to that I am stuck with it.
If you are having the same problem as me, check with phpinfo() if you are using a debug version of PHP. If you see that Debug Build has a value of yes, your problem will be fixed if you install a live version of PHP instead of a debug version
The Error itself is caused by running a Debug version of PHP 7, see the bug report. As noted by HPierce because it was a Debug build it overrides the usual PHP settings for error_reporting. However as the Original question is actually about how to hide certain [expected] error messages (Notices), my answer is to this detail specifically.
Kevin, the attempted ways to hide errors you've listed in your question would normally work on non-debug PHP builds. However, it is unwise to ignore the errors, rather than solving them at source. It's also (more) unwise to hide all errors simply due to having expected errors appearing.
As it's only a Notice, you can work around it by setting your error_reporting() value as below:
//report all errors except notices.
error_reporting(E_ALL & ~E_NOTICE);
I would suggest this is far wiser than turning off error reporting entirely which is not recommended. If you want to stop errors being output to browser (as referenced by Tina) you can use display_errors.
Perhaps you may also need to set
ini_set('error_reporting', 0);
depending on your php ini configuration?
Also make sure you set it before carrying out any of the code.
I have a staging server running a Yii application that now gives a 'white screen of death'. I cannot see anything being ouputted to the screen (or even the source code when 'view source'), locally the same code runs without any issues.
Can anyone suggest a good routine to debug 'white screen of death' within a Yii application?
Getting a blank screen in yii is mostly because error_reporting is off.
Put
error_reporting(-1);
ini_set('display_errors', true);
in index.php should get your output back.
Note that you can always look in application.log and apaches error.log for informations when you don't have some output.
This is for Yii2
I found the code was failing in vendor/yiisoft/yii2/BaseYii.php at method autoload($className). It was failing at execution:
include $classFile; (line 293)
The cause in my case was a function method name declared twice.
You might be interested to know that you can discover the cause (which Yii2 suppresses through its own error-handling) by preceding the command with Chris's recommended code above https://stackoverflow.com/a/25139283/3125602. If you introduce them too early in the code, they get overwritten by Yii2's error-handling settings.
It is quite a simple issue and happens either when a script reaches the PHP memory limit or during a plugin or theme conflict.
Solutions :
Increase the Memory Limit :
Since this is regarded as one of the cause, it is recommended that the PHP memory limit be increased. Edit your wp-config.php file via FTP adding the following line of code:
define( ‘WP_MEMORY_LIMIT’, ‘64’);
This increases your memory limit to 64M. You might need to contact your host before you do it as some host don’t allow it from your end.
Deactivate all your Plugins :
Connect to your site via FTP and rename the wp-content/plugins folder to plugins_old to deactivate all your plugins.
Here is a detailed answer to the infamous "White Screen of Death" problem. Thank me later :)
https://www.perceptionsystem.com/blog/wordpress-errors-solution/
I've copied a drupal6 site from a production server onto a dev server and have started trying to get it up and running and most of it runs ok except page variant.
On the live site the page variant shows on, on the dev site I can select the "Content" menu item and see all content that is supposed to be showing in the appropriate area however when It try to view on the front end on dev it shows the page wrapper but the main content area is blank.
When I click on the "Preview" menu item in the page variant admin the page doesn't display, however selecting this on the live server shows it fine.
It feels like a permissions / setting issue to me but so far I've not been able to figure it out. Any ideas?
This was a "Call-time pass-by-reference" issue and was caused by different PHP versions on live & dev. PHP 5.3 seems to allow the call allowed this call but gave a deprecation warning but the new dev server is on an updated version of PHP which doesn't allow this anymore (although it wasn't giving any errors either) so I had to make the following change (and will likely have several similar ones to do before I'm finished)
Had to update a function template_preprocess_panels_pane in in panels.module from
function template_preprocess_panels_pane($vars)
to
function template_preprocess_panels_pane(&$vars) {
as described in comment 21 on https://drupal.org/comment/6820396#comment-6820396
These was also a suggestion that you could update a php.ini value to allow call-time pass by reference (change allow_call_time_pass_reference = Off to allow_call_time_pass_reference = On in php.ini) but updating the code where necessary feels a better way to go.
I am trying to compile my magento store's code. Initially compiling was producing an error which I tracked down to the Fooman Speedster advanced module. I removed the module entirely from my store's code and again recompiled. The compilation successfully completed this time and all classes (around 7500) could be seen in the/includes/src/ folder.
However after compilation, my site's frontend is showing the white screen of death with no error being generated in the apache error log. What is strange is that the backend is working perfectly fine.
I have also increased my memeory limit for php scripts to 1024M so that php running out of memory is not the problem.
Any suggestions as to what might be the propblem or how to go about tracking the problem/bug.
Reposting my answer from here. Hope it will help
Magento white screen on Admin log in page?
I faced with the same problem. Actually it was even worse because it was a commercial product and a new hosting for me with really strange server configuration. So I couldn't made errors appear in any log file.
As I've found out the magento white screen means some PHP Fatal error occured. So there is a proper way to show them. Just add at the begin of your index.php
ini_set('error_reporting', E_ERROR);
register_shutdown_function("fatal_handler");
function fatal_handler() {
$error = error_get_last();
echo("<pre>");
print_r($error);
}
And you will see what is really happening with your magento.
This is how I got it corrected(Hope will help you guys):
Use the following code in your index.php file
ini_set('error_reporting', E_ERROR);
register_shutdown_function("fatal_handler");
function fatal_handler() {
$error = error_get_last();
echo("<pre>");
print_r($error);
}
In my case it tolde me that error/503.php was unavailable.
3.The issue was with testimonial extension I used(http://www.magentocommerce.com/magento-connect/magebuzz-free-testimonial.html)
I deleted the testimonial.xml file in my app/etc/modules/testimoanial.xml.
delete “maintenance.flag" file.
I deleted all the folders from my var->cache directory and frontend started working.
As I read, it is caused by when your Persistent Shopping Cart enabled.
Set System > Configuration > Persistent Shopping Cart > General Options > Enable Persistence to disabled and try again.
You can have a look here.
It's a common problem with compilation, you can temporarily disable compilation by editing /includes/config.php and commenting out these lines:
define('COMPILER_INCLUDE_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'src');
define('COMPILER_COLLECT_PATH', dirname(__FILE__).DIRECTORY_SEPARATOR.'stat');
After a lot of research and testing, I have come to the conclusion that while compiling there may be several errors that lead to the white screen of death. These will not be visible for some reason leaving you with no clue as to where is the problem.
In most cases - custom modules or installed modules are the culprits. The only reliable way to debug the magento compilation is to use the xdebug.scream = 1 in the xdebug configuration. This will scream out the error file/reason which can then be worked upon.
A better explanation could be found here:
http://www.brimllc.com/2012/03/magento-fun-with-debugging-the-magento-compiler/
Another reason for not seeing any error in any log might be the APC cache.
See my Stackoverflow answer here for more details.
You can
disable it via .htaccess: php_flag apc.cache_by_default off
clear the apc cache every time the page is called: add at the top of index.php apc_clear_cache(); (no solution but good to see if the APC is the problem)