StdClass not found fatal error

Created on 19 October 2012, about 12 years ago
Updated 25 April 2023, over 1 year ago

Having trouble getting the basics working.

What I did:

- I have a module with underscores in its name and I put MyClass.php in sites/all/custom/modules/my_module/lib/Drupal/my_module/MyClass.php
- I used a namespace Drupal\my_module in that class file
- I use Drupal\my_module\MyClass in a page call back in my_module.module
- I am NOT declaring using core drupal 7 files[] autoloading in info file

What happens when trying to create an instance of MyClass:

Fatal error: Class 'Drupal\my_module\StdClass' not found in /path/to/drupal/sites/all/modules/custom/my_module/lib/Drupal/my_module/MyClass.php on line foo

So the class file path is definitely correct so xautoload is definitely kicking in but something is going wrong after that and I can't work out why it's complaining about StdClass and not MyClass.

💬 Support request
Status

Closed: works as designed

Version

2.3

Component

Documentation

Created by

🇦🇺Australia boztek

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