Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recoverable fatal error #262

Open
kleinermann opened this issue Oct 10, 2017 · 4 comments
Open

Recoverable fatal error #262

kleinermann opened this issue Oct 10, 2017 · 4 comments

Comments

@kleinermann
Copy link

kleinermann commented Oct 10, 2017

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.

@s-patompong
Copy link

I have exactly the same problem. Could someone from the dev team help please?

@stasdk3000
Copy link

stasdk3000 commented Apr 18, 2019

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'] = '';
        }
      }

@BMo-design
Copy link

BMo-design commented May 18, 2019

Better replace $result = ''; with $result = array(); in line 448 this solves the problem for all media types.

@grigorii-horos
Copy link

I have same issue, @BMo-design Solution works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants