Closed afxdesign closed 9 years ago
As also explained in #51, I'd rather not wrap the entire class in such an if statement, as that's not the solution but just patchwork. We'll look into a proper autoloader as we approach 1.6, which should tackle this issue.
Hi,
I have to admit I came across this bug when amending my own plugin code to use your class_exists syntax - previously I had wrapped the class in the else also e.g:
After doing this I started getting random class redeclaration errors. After a lot of investigation I realised it was because xcache was causing the class to be loaded before the return statement. In essence it incorrectly scopes the class outside the return statement.
There are youtube videos demonstrating the problem at stackoverflow: http://stackoverflow.com/questions/17603403/php-cannot-redeclare-class-error-after-return
It caused me a massive headache trying to work out what was going on. As xcache is used a lot in the wild I thought you might like to know. I would recommend setting up a autoloader or wrapping the class in else tags e.g.