Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

How to resolve autoload / spl conflicts?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3
View previous topic :: View next topic  
Author Message
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Fri Nov 06, 2009 8:47 am    Post subject: How to resolve autoload / spl conflicts? Reply with quote

Here is my directory structure of class files, and auto loaded with __autoload():
Code:
<root>/classes/*/class.*.inc.php


Smarty and PHPMailer are the only two third party applications in my reservoir. Hence I do it manually:

Code:
# Runnng copy
#require_once(__ROOT__.'/classes/third/smarty-2.6.2/Smarty.class.php');

# Problomatic
require_once(__ROOT__.'/classes/third/smarty-3.0.1b/Smarty.class.php');


and then define __autoload() as usual.
But the order of Smarty Includes and __autoload() do not really have a sense. However, it does not allow me to use Smarty 3.

And everything is good with Smarty 2.6, but not with 3. I am running both the versions.

How can I resolve this conflict?
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Nov 06, 2009 3:03 pm    Post subject: Reply with quote

Have you tried the latest SVN of Smarty 3?
Back to top
View user's profile Send private message Visit poster's website
bimal
Smarty Elite


Joined: 19 Apr 2007
Posts: 423

PostPosted: Fri Nov 06, 2009 4:09 pm    Post subject: Latest version Reply with quote

Yes, I am sure, it is the latest version of Smarty 3. Any luck?

Finally my words are:
The distributed version of Smarty has some problems, while the current SVN files at http://smarty-php.googlecode.com/svn/trunk/libs are good.

I am now, testing...

Thanks.
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Nov 06, 2009 10:37 pm    Post subject: Reply with quote

The latest SVN removes the use of spl_autoload and instead uses the smartyAutoloader by default.
Back to top
View user's profile Send private message Visit poster's website
Michael White
Smarty Rookie


Joined: 08 Oct 2009
Posts: 20

PostPosted: Sat Nov 07, 2009 10:44 pm    Post subject: Released Smarty 3 Beta Autoloader bug. Reply with quote

In the version of Smarty 3 Beta (Smarty-3.0-b1) released on Oct. 31st (the download link on the downloads page - not in SVN) the Smarty.class.php script has the following on line 95:

Code:

spl_autoload_register();


The autoloader should be registered as follows:

Code:

spl_autoload_register('smartyAutoload');


Just replace the current line 95 with the new one to fix this bug.
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Mon Nov 09, 2009 5:51 pm    Post subject: Reply with quote

By define('SMARTY_SPL_AUTOLOAD',1); in your script you can now select the buildin 'spl_autoload' instead of the default 'smartyAutoloader'.

Note that the constant must be defined before you include the Smarty.class.php.

The corresponding update is in the SVN.
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Smarty 3 All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP