How to eliminate error warnings about ini_set? - wordpress

my wordpress error log is filling up with this message:
PHP Warning: ini_set() has been disabled for security reasons in
/home/mywebsite/public_html/wp-includes/load.php on line 271
that line reads: ini_set( 'display_errors', 0 );
any suggestions on how to eliminate error warnings?

You are seeing that error because the XMLRPC_REQUEST constant is set to true, which causes WordPress to try and disable error reporting with the following:
if ( defined( 'XMLRPC_REQUEST' ) )
ini_set( 'display_errors', 0 );
Editing core Wordpress files is not recommended. They will be overwritten when you update or autoupdate. The correct way to correct for this is to edit the php.ini file on the server and remove ini_set from the disable_functions directive.
You could also set display_errors to Off, or alternatively change the error_reporting directive as well to prevent warnings from being shown.
error_reporting = E_ERROR
You could also try using the error_reporting() PHP function in wp-config.php to try and disable warnings as well.
// Turn off all error reporting
error_reporting(0);
// Only show errors
error_reporting(E_ERROR);
One other suggestion I have never tried to is to override the php.ini values via .htaccess which may or may not work on your host - see this guide.

Related

Undefined array key in wp-includes/class-wp-list-util.php

I'm getting an error when I click on the abandoned cart email link.
Warning: Undefined array key "line_total" in wp-includes/class-wp-list-util.php on line 169
There is 4 method to fix this error:
1: Go To Dashboard -> Update -> On You have the latest version of WordPress, click Re-Install Now.
2: try to use the default WordPress theme to see if your current theme causes this error.
3: Sounds like you are using an incompatible plugin, try disabling plugins one by one to find which plugin causes this error.
4: Finally you may disable wp_debug to ignore this error, go to wp-config.php
and find and set it to disable like the example below:
define( 'WP_DEBUG', false);

Wordpress returns no content for certain admin pages like post.php

I have a wordpress site that was running fine with version 5.7.2. Everything was working as expected (as far as I know). Today I upgraded to 5.8 (using the onclick upgrade within wordpress itself). Since then the post.php simply does nothing, it just closes the connection whenever you go to it (this is also the same for post-new.php, uploads.php, user-edit.php user-new.php but not users.php ). I cant find any errors in the apache logs (and I have the error recording turned on in the php.ini, and there is no output in the wordpress debug.log despite having the following settings:
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true );
in the wp-config.php.
The site itself appears to work as expected, all of the pages and plugins work. I have used the Health Check & Troubleshooting plugin to run the site with all the plugins and themes disabled and this does not address the issue. The issue is not tied to a single client as I can login on different devices and I get the same error.
The error is not just on post.php, but can also be seen by visiting certain admin pages, for example the yoast plugin, whenever try to use the admin pages you get the same error.
After a bit more digging I found the following error in the apache error logs (not the one specific to my vhost)
double free or corruption (out)
free(): invalid next size (fast)
free(): invalid next size (fast)
[Sun Sep 05 22:38:50.226213 2021] [core:notice] [pid 53059] AH00052: child pid 53063 exit signal Aborted (6)
This error would appear any time you load one of the effected pages.
On doing more research I found from here https://github.com/oerdnj/deb.sury.org/issues/622 that having both the php modules for graphicsmagick and imagemagick would cause this memory error. I removed graphicsmagick and everyhing works again.

Wordpress "CURLOPT_SSL_VERIFYHOST" turned off

I'm working on my wordpress site hosted by a domain (not working in my local environment)
I got the error : "Fatal error: [snuffleupagus][disabled_function] Aborted execution on call of the function 'curl_setopt', because its argument '$option' content (81) matched the rule 'Please don't turn CURLOPT_SSL_VERIFYHOST off.'" in the function based on the cURL.php file.
I downloaded the Cacert.pem file but I don't know where should I put it or should I change something in my cURL.php
Looks like a setting in your hosting, you could try adding this to your themes functions.php
add_filter( 'https_local_ssl_verify', '__return_true' );
https://core.trac.wordpress.org/ticket/50748
It error is caused by a snuffleupagus rule(81) which doesn't allow you to disable the test.
Disabling the rule is a security concern and you show rather update the php code.
You can disable the rule on a cpanel server in /usr/share/cagefs/.cpanel.multiphp/opt/cpanel/ea-php74/root/etc/php.d/20-snuffleupagus.rules.d/default.rules
# Ensure that certificates are properly verified
sp.disable_function.function("curl_setopt").param("value").value("1").allow();
sp.disable_function.function("curl_setopt").param("value").value("2").allow();
# `81` is SSL_VERIFYHOST and `64` SSL_VERIFYPEER
#sp.disable_function.function("curl_setopt").param("option").value("64").drop().alias("Please don't turn CURLOPT_SSL_VERIFYCLIENT off.");
#sp.disable_function.function("curl_setopt").param("option").value("81").drop().alias("Please don't turn CURLOPT_SSL_VERIFYHOST off.");

Wordpress site down after leadpage plugin installation

I have a Wordpress site and when updating a leadpages plugin, I am seeing the following error...
Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home2/dhankaran/public_html/wp-content/plugins/leadpages/App/Bootstrap/AdminBootstrap.php on line 196
I don't know where this file resides so I cannot update the code. please help!
Thanks
DK
Switch your display errors OFF from cpanel or wp-config.php, This may be the issue...
// Write this code in wp-config.php
// log php errors
#ini_set('log_errors','On'); // enable or disable php error logging (use 'On' or 'Off')
#ini_set('display_errors','Off'); // enable or disable public display of errors (use 'On' or 'Off')
Also check wp_debug in wp-config.php
define('WP_DEBUG', false); // disable debugging mode

Wordpress charset error only happening occasionally

I get the following error on my website, it only happens occasionally.
The host conpany say it is cause dby not using mysql_close in all scripts but I thought PHP did that by default. Either way, I have the standard wordpress installtion so not sure which script could be causing this.
Warning: mysql_set_charset(): Error executing query in /mysite.com/wp-includes/wp-db.php on line 715
Warning: Cannot modify header information - headers already sent by (output started at /mysite.com/wp-includes/wp-db.php:715) in /mysite.com/wp-includes/pluggable.php on line 1121
Why don't you just disable errors / warnings? Put error_reporting(0); in wp config file wp-config.php exactly below call of wp-settings.php and it won't display any errors / warnings.
/** Sets up WordPress vars and included files. */
require_once(ABSPATH . 'wp-settings.php');
error_reporting(0);

Resources