View previous topic :: View next topic |
Author |
Message |
andig Smarty Regular
Joined: 22 Apr 2004 Posts: 48
|
Posted: Fri Feb 26, 2010 12:39 pm Post subject: |
|
|
Hi Uwe, Monty,
as our other attempts were not successful, I'd like to digg deeper into the compile error. Is there a place I should look to see which functions the compiler should recognize (e.g. an array of function names or similar) that I could var_dump to see if it's more a compiler-thing or happens previously when gathering the plugins from disk?
Best regards,
Andreas |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Feb 26, 2010 12:47 pm Post subject: |
|
|
Andrea
I just saw by FTP that you still have an old Smarty version in the /lib/smarty folder |
|
Back to top |
|
andig Smarty Regular
Joined: 22 Apr 2004 Posts: 48
|
Posted: Fri Feb 26, 2010 12:53 pm Post subject: |
|
|
Digging into the template compiler I'm seeing that the getPlugin function is called with different arguments depending on the machine (Win/local, Linux/hosted) it's being called:
local working: getPlugin(html_image, function)
hosted broken: getPlugin(html_, block) |
|
Back to top |
|
andig Smarty Regular
Joined: 22 Apr 2004 Posts: 48
|
Posted: Fri Feb 26, 2010 1:00 pm Post subject: |
|
|
Wondering what this error/ line in the compiler base is doing on the server:
Warning: substr_compare() [function.substr-compare]: The start position cannot exceed initial string length in /hp/aa/ad/gq/www/cpuidle-de/videodb/lib/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 145
// not an internal compiler tag
if (strlen($tag) < 6 || substr_compare($tag, 'close', -5, 5) != 0) {
Why should the comparison index be -5? The php docs do not mention this case. Is strlen-5 the desired position? maybe we're seeing a php bug here?
Best regards,
Andreas |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Feb 26, 2010 1:07 pm Post subject: |
|
|
PHP documentation says :
The start position for the comparison. If negative, it starts counting from the end of the string.
What PHP version do you work with? |
|
Back to top |
|
andig Smarty Regular
Joined: 22 Apr 2004 Posts: 48
|
Posted: Fri Feb 26, 2010 1:08 pm Post subject: |
|
|
Even this does still print the warning, so the -5 index is not the problem:
if (strlen($tag) < 6 || substr_compare($tag, 'close', strlen($tag)-5, 5) != 0) {
Still, I think the problem is substr_compare. PHP doc says:
Returns < 0 if main_str from position offset is less than str, > 0 if it is greater than str, and 0 if they are equal. If length is equal or greater than length of main_str and length is set, substr_compare() prints warning and returns FALSE.
What I believe happens is that html_image (10 chars) is compared from pos. 5 for 5 chars (which should be valid), yet PHP shows the warning and returns FALSE -> hence plugin is not found. PHP does actually not comply with docs in this case.
Will fup with php.net |
|
Back to top |
|
andig Smarty Regular
Joined: 22 Apr 2004 Posts: 48
|
Posted: Fri Feb 26, 2010 2:18 pm Post subject: |
|
|
My last suspicion seems to be confirmed: http://bugs.php.net/bug.php?id=37394
The docs however are still wrong as they do not take the case of offset+length = strlen into account:
"If offset is equal to or greater than the length of main_str or length is set and is less than 1, substr_compare() prints a warning and returns FALSE."
Best regards,
Andreas |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Fri Feb 26, 2010 2:32 pm Post subject: |
|
|
So you should update the PHP version... |
|
Back to top |
|
andig Smarty Regular
Joined: 22 Apr 2004 Posts: 48
|
Posted: Fri Feb 26, 2010 2:35 pm Post subject: |
|
|
Sure. Now explain that to my provider...
For now this works fine:
if (strlen($tag) < 6 || strncmp(substr($tag, -5), 'close', 5) != 0) {
again- thank you for the great support!
Best regards,
Andreas |
|
Back to top |
|
|