Fixed php 5.4 bug

  • Thread starter Thread starter ragtek
  • Start date Start date
Okay you can fix it a few ways. The way I have chosen for now as to only affect <xen:set> and only when <xen:set> has no children.
In library/Template/Compiler/Tag/Set.php place
Code:
if (empty($children))
{
$children = 'null';
}
Before
Code:
$childOutput = $compiler->compileIntoVariable($children, $var, $options, false);

Someone should make a a TMS add-on to do make template changes for the average user though.

EDIT: nevermind this causes issues elsewhere... *looking more
EDIT2: adding return $__output === null ? '' : $__output; to XenForo_Template_Abstract->render will get this working.
 
The "proper" fix at code level is to return a properly checked array... I have no idea where it has to be implemented.
Please stop posting that ternary operator empty string. :giggle:
 
Band-aid applied.
If by band-aid do you only suppress the errors....?

This really will not be good enough. This is something a lot of other developers have done and really... It's not good enough (so many reasons, but 1 comes to mind is people will not be aware of issues in code or conflict).

So fix or just "band-aid" ????
 
I'm still getting the same error with PHP 5.4 and XenForo 1.1.3.

Has anyone else experienced it?

I've just done a fresh install of XenForo 1.1.3 and the error is still there in numerous places.

Template Errors: thread_create

  1. Illegal string offset 'thumbnailUrl' in C:\wamp\www\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 416:
    415: <li id="' . (($__compilerVar12) ? ('AttachedFileTemplate') : ('attachment' . htmlspecialchars($__compilerVar13['attachment_id']))) . '"
    416: class="AttachedFile ' . (($__compilerVar13['thumbnailUrl']) ? ('AttachedImage') : ('')) . ' secondaryContent">
    417:
  2. Illegal string offset 'thumbnailUrl' in C:\wamp\www\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 420:
    419: ';
    420: if ($__compilerVar13['thumbnailUrl'])
    421: {
  3. Illegal string offset 'filename' in C:\wamp\www\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 435:
    434: $__compilerVar14 .= '
    435: <!--<img src="' . XenForo_Template_Helper_Core::styleProperty('imagePath') . '/xenforo/widgets/page.png" alt="' . htmlspecialchars($__compilerVar13['filename']) . '" />-->
    436: <span class="genericAttachment"></span>
  4. Illegal string offset 'filename' in C:\wamp\www\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 443:
    442: <div class="AttachmentText">
    443: <div class="Filename"><a href="' . XenForo_Template_Helper_Core::link('attachments', $__compilerVar13, array()) . '" target="_blank">' . htmlspecialchars($__compilerVar13['filename']) . '</a></div>
    444:
 
Well, it definitely isn't working on WAMP at least.

I upgraded my local WAMP installation to the version that includes PHP 5.4. And I get the errors. If I switch back to PHP 5.3 the errors are gone.

So although this error is supposed to be fixed in presumably 1.1.3 - it isn't.
 
I'm still getting the same error with PHP 5.4 and XenForo 1.1.3.

Has anyone else experienced it?

I've just done a fresh install of XenForo 1.1.3 and the error is still there in numerous places.

Template Errors: thread_create

  1. Illegal string offset 'thumbnailUrl' in C:\wamp\www\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 416:
    415: <li id="' . (($__compilerVar12) ? ('AttachedFileTemplate') : ('attachment' . htmlspecialchars($__compilerVar13['attachment_id']))) . '"
    416: class="AttachedFile ' . (($__compilerVar13['thumbnailUrl']) ? ('AttachedImage') : ('')) . ' secondaryContent">
    417:
  2. Illegal string offset 'thumbnailUrl' in C:\wamp\www\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 420:
    419: ';
    420: if ($__compilerVar13['thumbnailUrl'])
    421: {
  3. Illegal string offset 'filename' in C:\wamp\www\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 435:
    434: $__compilerVar14 .= '
    435: <!--<img src="' . XenForo_Template_Helper_Core::styleProperty('imagePath') . '/xenforo/widgets/page.png" alt="' . htmlspecialchars($__compilerVar13['filename']) . '" />-->
    436: <span class="genericAttachment"></span>
  4. Illegal string offset 'filename' in C:\wamp\www\library\XenForo\Template\Abstract.php(265) : eval()'d code, line 443:
    442: <div class="AttachmentText">
    443: <div class="Filename"><a href="' . XenForo_Template_Helper_Core::link('attachments', $__compilerVar13, array()) . '" target="_blank">' . htmlspecialchars($__compilerVar13['filename']) . '</a></div>
    444:
I can confirm this.

But here is the odd thing..... I can only confirm it "sometimes" and only on a fresh install.

I discovered this when installing things on a test site. Which I have the habit of deleting and starting over ( A LOT ).

It really is totally random.
 
I can't actually confirm... I have a LOT of test sites and it is hard to keep track anyway. Also I had my own hacks in place that could still be working maybe... I'll find time later to check their actual fix.
 
I believe I found the cause.

This only happens when you have debug mode on. Which of course will affect anyone with a test site or who is developing an add-on.

This can of course confuse people and any errors could end up being mixed up with this and mistakenly ignored.
 
Top Bottom