Call to a member function getDirectoryPath() on boolean in /modules/image/image.module on line 83

Created on 27 November 2017, over 6 years ago
Updated 24 April 2024, about 2 months ago

As the title states, I started to get this error randomly on a D7 site.

PHP Fatal error: Call to a member function getDirectoryPath() on boolean in /modules/image/image.module on line 83

I am supplying a patch to fix the fatal error. I think Xautoload may be the culprit, but not 100% sure. If anyone else has experienced this, please let me know.

🐛 Bug report
Status

Needs work

Version

7.0 ⚰️

Component
Image system 

Last updated 1 day ago

Created by

🇺🇸United States labboy0276

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
  • 🇮🇹Italy apaderno Brescia, 🇮🇹
    -  $directory_path = file_stream_wrapper_get_instance_by_scheme('public')->getDirectoryPath();
    +  $wrapper = file_stream_wrapper_get_instance_by_scheme('public');
    +  $directory_path = ($wrapper instanceof MediaReadOnlyStreamWrapper)
    +                    ? $wrapper->getDirectoryPath()
    +                    : 'sites/default/files';
    +
       $items[$directory_path . '/styles/%image_style'] = array(

    Drupal 7 does not define any MediaReadOnlyStreamWrapper class. If that is a class defined from a contributed module, it is the contributed module that needs to fix its own code. Drupal code cannot depend on classes defined from contributed modules.

Production build 0.69.0 2024