Attempt to Instantiate Missing Class

Created on 30 April 2016, over 8 years ago
Updated 26 August 2023, about 1 year ago

BACKGROUND - I copied the PRD database for a site to the DEV install and started getting a fatal error that a class could not be found. Error was from mailsystem.module line 293

PROBLEM - Attempting to instantiate a class without confirming that it has been defined.

SOLUTION - Added a class_exists()

// ORIGINAL
      if ( ($autoload || preg_match('/MailSystem/', $classname))
        && ($object = new $classname)
        && ($object instanceof MailSystemInterface)
      ) {

// FATAL ERROR WENT AWAY 
      if ( ($autoload || preg_match('/MailSystem/', $classname))
        && class_exists( $classname )
        && ($object = new $classname)
        && ($object instanceof MailSystemInterface)
      ) {
🐛 Bug report
Status

Needs work

Version

2.0

Component

Code

Created by

🇺🇸United States JasonSafro

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.

Production build 0.71.5 2024