Call to error_get_last() causing PHP Notices in debug.log
-
Hello,
In the file wc_yotpo.php on line 453 is this code:
$error=error_get_last();
The function error_get_last() will return an array or null.
The next line checks the
$error
variable as if it is an array:if($error['type'] == 1){
If the variable is null then a PHP Warning gets thrown every time the plugin is loaded:
> PHP Notice: Trying to access array offset on value of type null in
This produces a lot of misleading and unnecessary notices. I think the ob_start(‘fatal_error_handler’) can be removed since it’s not really needed, or at very least, change the code to check for an array like this:
if( is_array( $error ) && $error['type'] === 1){ // use strict comparison!
For now on a client’s site we’re going to comment this out, but it would be great to have the notices cleaned up in a future version.
Thanks!
- The topic ‘Call to error_get_last() causing PHP Notices in debug.log’ is closed to new replies.