Magic-Fields-2
Magic-Fields-2 copied to clipboard
Recoverable fatal error
I get the following fatal error (see below after the warnings):
Warning: Illegal string offset 'original' in /Applications/MAMP/htdocs/bussenstueble.de/wordpress/wp-content/plugins/magic-fields-2/mf_front_end.php on line 523
Warning: Illegal string offset 'original' in /Applications/MAMP/htdocs/bussenstueble.de/wordpress/wp-content/plugins/magic-fields-2/mf_front_end.php on line 527
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; mfthumb has a deprecated constructor in /Applications/MAMP/htdocs/bussenstueble.de/wordpress/wp-content/plugins/magic-fields-2/MF_thumb.php on line 12
Warning: Illegal string offset 'thumb' in /Applications/MAMP/htdocs/bussenstueble.de/wordpress/wp-content/plugins/magic-fields-2/mf_front_end.php on line 527
Recoverable fatal error: Object of class WP_Error could not be converted to string in /Applications/MAMP/htdocs/bussenstueble.de/wordpress/wp-content/plugins/magic-fields-2/mf_front_end.php on line 527
This only happens on my local test environment.
I have checked in mf_front_end.php. This is the code from line 523:
$result['original'] = $data[0];
if( empty($options) ){
$result['thumb'] = $result['original'];
}else{
$result['thumb'] = aux_image($result['original'],$options,$type);
if ( is_wp_error($result['thumb']) ){
$result['error'] = $result['thumb']->get_error_message();
$result['thumb'] = '';
}
}
I've checked the $result variable and found that it contains an empty string, which causes the script to throw an error. I don't understand why the $result variable could be empty. I'd be very grateful for any tip.
I have exactly the same problem. Could someone from the dev team help please?
I have exactly the same problem. Could someone from the dev team help please?
need to set type for $result to array:
$result = array();
$result = array(); //fix $data = wp_get_attachment_image_src($value,'original'); $result['original'] = $data[0]; if( empty($options) ){ $result['thumb'] = $result['original']; }else{ $result['thumb'] = aux_image($result['original'],$options,$type); if ( is_wp_error($result['thumb']) ){ $result['error'] = $result['thumb']->get_error_message(); $result['thumb'] = ''; } }
Better replace $result = '';
with $result = array();
in line 448 this solves the problem for all media types.
I have same issue, @BMo-design Solution works.