Smarty 3.0 - LogicException |
[eluser]mvdg27[/eluser]
Hi guys, Today I decided I wanted to play around with Smarty3.0 (beta) for a bit. But I'm encountering an error, and I don't really understand where it's coming from. What I've done so far is creating a class called smarty_parser in my Application libraries. The library requires the Smarty 3.0 class (all files are located inside a subfolder smarty3.0 inside the libraries folder) and it extends the Smarty class. Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); I haven't done anything else yet, as this already throws an error ... I found already that the error is caused by requiring the Smarty class. When I comment this out, I don't get this error. Code: Fatal error: Uncaught exception 'LogicException' with message 'Class CI_Smarty_parser could not be loaded' in /system/libraries/Loader.php:879 Can anyone explain me what could be causing this error? I'm happy to spend some time getting it to work, but it's getting kind of difficult if I don't get what's going wrong Thanks! -Michiel
[eluser]Mubsel[/eluser]
Hi! I think this is a problem with the Smarty3 beta. I had a Smarty3 alpha (from svn) running for a few days, and had no problems. The alpha version had this code in "Smarty.class.php" in line 83. Code: spl_autoload_register('smartyAutoload'); Code: if (set_include_path(SMARTY_SYSPLUGINS_DIR . PATH_SEPARATOR . get_include_path()) !== false) { When I change this to the "alpha-code" it works again - so the problem has something to do with the new code. I'm trying to find out what the problem is. Greetz M.
[eluser]Mubsel[/eluser]
The problems has something to do with line 879 in"/system/libraries/Loader.php" (-> error message). Code: if (class_exists('CI_'.$class)) Wrap a try-catch-block around the above code, and it works! Code: try http://bugs.php.net/bug.php?id=39313 and http://bugs.typo3.org/view.php?id=11176 We are running PHP 5.2.0-8+etch13. Greetz M.
[eluser]mvdg27[/eluser]
Hi Mubsel, You seem to be right! I removed this code block: Code: if (set_include_path(SMARTY_SYSPLUGINS_DIR . PATH_SEPARATOR . get_include_path()) !== false) { And replaced it with: Code: spl_autoload_register('smartyAutoload'); And now everything works like a charm. I haven't spotted any faulty behaviour so far. Though still wondering if removing this code block won't introduce any errors in the future. Anyone an idea what this code might be for? Michiel
[eluser]mvdg27[/eluser]
Hi there .. we posted at exactly the same time You are actually saying that this is caused by a bug in CI, rather that something in Smarty? Cheers, Michiel
[eluser]Mubsel[/eluser]
Hi Michiel, the "new" code in Smarty3 beta is using the native autoload-function(s). 1) It is adding the sysplugin-path to the php-include-path. 2) It sets the autoloader to check first for a file with php-extension and in the second run for inc-extension 3) Checks if the default-autoload function is already loaded and loads it if it is not. Code: spl_autoload_register('smartyAutoload'); Greetz M.
[eluser]Mubsel[/eluser]
Nope! Looks more like a bug in php 5.2.0! Look at the link in my second post. Maybe you are running that version. Solution A) Update your php-version Solution B) Hack your CI-Code Solution C) Hack Smarty :-) Greetz M.
[eluser]mvdg27[/eluser]
Ah yes .. I see it now. I'm running PHP5.2.0 yes. I guess for now I'll use my Smarty fallback solution, until I plan for a server upgrade. Thanks for your help! Michiel
[eluser]dkf_aimar[/eluser]
Hi, I am also play with Smarty3.b5 under CI1.7.2. And I have received an error : Code: Fatal error: Class 'Smarty_Internal_TemplateBase' not found in /home2/fivonean/public_html/application/libraries/Smarty-3.0b5/libs/Smarty.class.php on line 110 However, it works fine on my local (Win7 + WAMP2.0i), but not working on my host (Apache version 2.2.14 (Unix) + PHP version 5.2.11). Is there anyone can give some ideas? Thanks a lot. Regards |
Welcome Guest, Not a member yet? Register Sign In |