View previous topic :: View next topic |
Author |
Message |
zbmowrey Smarty n00b
Joined: 01 Feb 2018 Posts: 3
|
Posted: Thu Feb 01, 2018 3:36 pm Post subject: Autoloader not finding class Smarty_Internal_Compile_Cycle |
|
|
Hi,
I'm updating an older codebase so that we can migrate from PHP 5.5 to 7.0 (Big job, I know).
On our PHP 7.0.27 box (Apache 2.2.15), I've installed the latest Smarty (3.1^) using Composer.
I've put the require_once for vendor/autoload.php at the top of our index; we do use a custom autoloader, but prepend is false so Composer's autoloader (and thus Smarty's) should be at the top of the stack.
My problem is that on some child pages (not all), we see that our custom autoloader is being told to load this class:
Smarty_Internal_Compile_Cycle
...Which doesn't exist. Multiple search engines, these forums, and scanning the code all turn up nothing.
I'm reading this as if Smarty's autoloader couldn't find the class, Composer's autoloader couldn't find it, and finally our in-house autoloader tried (and naturally failed).
Roughly 50% of our pages load fine with no issues, and the other 50% fail with this problem. I've reviewed the TPLs to see if there's something different about them, but I'm not seeing it. We are by no means pushing the boundaries of Smarty, it's all really basic variable calls and some foreach loops. And every page has those.
Can someone offer me some ideas to try for isolating the issue, or give me some direction to move in so I can give better/more detailed data if needed?
Thank you in advance! |
|
Back to top |
|
zbmowrey Smarty n00b
Joined: 01 Feb 2018 Posts: 3
|
Posted: Thu Feb 01, 2018 3:58 pm Post subject: |
|
|
After further research, I found the underlying issue:
<tr class="{cycle values='odd,even'}">
This code is causing the error. I can fix our code by removing since we're going to switch our table layout/ux anyway.
Not sure why it's trying to find a class that doesn't exist, though. This call is documented in v3 (unless I'm misreading things), so I'd guess it's there. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
zbmowrey Smarty n00b
Joined: 01 Feb 2018 Posts: 3
|
Posted: Thu Feb 01, 2018 7:34 pm Post subject: |
|
|
I appreciate your response. In the long term I'd rather understand what went wrong here (because I don't want any other surprises later), but for expediency I pulled out the cycles and as far as I can tell everything else is working perfectly.
If I ever do figure out the underlying cause, I'll add it here. |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Fri Feb 02, 2018 11:55 pm Post subject: |
|
|
Please try the Smarty command using quotes around the complete string of comma-separated list of arguments -- as opposed to using apostrophes.
Might make a difference. It did for me on a few other Smarty commands. |
|
Back to top |
|
bsmither Smarty Elite
Joined: 20 Dec 2011 Posts: 322 Location: West Coast
|
Posted: Sat Feb 03, 2018 12:05 am Post subject: |
|
|
There is /plugins/function.cycle.php
Is there any way to get a backtrace up to the point where the call for Smarty_Internal_Compile_Cycle is made? |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Mon Apr 09, 2018 12:45 pm Post subject: |
|
|
We use code like Code: | class_exists($classname, [true]) |
to try to find compiler code or after that try plugins.
The class Smarty_Internal_Compiler_Cykle does not exists. next step would be to look in the plugin folder.
However this does only work if the autoloader return false if the class does not exists. There are some composer options which will disable this functinallity
see also https://github.com/smarty-php/smarty/issues/344 |
|
Back to top |
|
|