PHP 7 and XF issue i identified

king8084

Well-known 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
 
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.
 
Top Bottom