1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP 7 and XF issue i identified

Discussion in 'Troubleshooting and Problems' started by king8084, Oct 5, 2016.

  1. king8084

    king8084 Active Member

    so, i have one theme that will give server errors, i did remove parts of the theme that is different than my other themes until i found the code that is causing the errors

    it is this code inside message template

    <span class="authorEnd"><xen:username user="$post" class="author" /></span>
    <!-- <xen:hook name="message_user_info_text" params="{xen:array 'user={$user}', 'isQuickReply={$isQuickReply}'}">
    <h3 class="userText"><span class="authorEnd"><xen:username user="$user" itemprop="name" rich="true" /></span></h3>
    </xen:hook> -->
    <!-- Slyk 2.0 <a href="{xen:link threads/post-permalink, $thread, 'post={$post}'}" title="{xen:phrase permalink}" class="desktopPermalink datePermalink"><xen:datetime time="$post.post_date" /></a>-->
    <span class="desktopPermalink datePermalink"><xen:datetime time="$post.post_date" /></span>

    any idea why this code will have problems with php 7? this code didnt cause issues when we ran php 5
  2. Chris D

    Chris D XenForo Developer Staff Member

    What are the errors that this code causes?
  3. Chris D

    Chris D XenForo Developer Staff Member

    I just tried it locally, and I agree it causes a server error. This isn't a bug, though. The difference between PHP 5 and PHP 7 may be one of configuration of how errors are handled.

    If what you say is correct about using this in the message template, then it's likely because the $post variable isn't available to the message template. If you switch all of those $post references out for $message (even the commented out ones) you'll likely find it works as expected.
    king8084 likes this.
  4. king8084

    king8084 Active Member

    TypeError: Argument 1 passed to XenForo_Template_Helper_Core::helperUserNameHtml() must be of the type array, null given, called in /home/html/******/library/XenForo/Template/Helper/Core.php on line 853 -library/XenForo/Template/Helper/Core.php:1671
  5. Chris D

    Chris D XenForo Developer Staff Member

    Exactly what I expected seeing as the $post variable will indeed be null there.
    king8084 likes this.

Share This Page