aminho
aminho

Reputation: 565

Symfony2 seems to break __autoload

I'm currently integrating non symfony2 software (let's call it nsf) in an sf2 project. That software uses __autoload.

When trying to access some nsf features in a twig extension, I get fatal errors about classes not found. It appears that when called from symfony2 code, the __autoload function is not called at all.

I recently moved to php5 so this might sound like a newbie question but I'm trying to figure out what's going on.

Thanks for your clues.

Upvotes: 0

Views: 122

Answers (1)

Nanne
Nanne

Reputation: 64399

This sounds like a problem originating in the usage of __autoload. If you can, replace those calls with the 'new' spl_autoload_register() call currently adviced:

see: http://php.net/manual/en/language.oop5.autoload.php

spl_autoload_register() provides a more flexible alternative for autoloading classes. For this reason, using __autoload() is discouraged and may be deprecated or removed in the future.

__autoload() is only one function, and is prone to overriding if 2 files want to do something with that. Using spl_autoload_register() means you can register several autoload functions.

Upvotes: 3

Related Questions