XenForo 1.5 + CodeIgniter 3.x + PHP native 5.3

puneetkay

Member
Hi everyone,

I have website based on CodeIgniter 3.x closely integrated with XenForo 1.5.
Website uses XenForo user management so XenForo library is invoked on almost every page specially when user is logged in.

It works fine with PHP native 5.3. But when I change PHP version to any between 5.3 and 5.6, it behaves abnormally on frontend (views).

For example, I have these three files:

index.php
Code:
<?php $this->load->view('header'); ?>
This is index file.
<?php $this->load->view('footer'); ?>

header.php
Code:
This is header file.

footer.php
Code:
This is footer file.

Output should be, which is fine with PHP native 5.3:
Code:
This is header file.
This is index file.
This is footer file.

But on others, output is something like this:
Code:
This is header file.
This is footer file.
This is index file.

So clearly, its loading $this->load->view() before the actual content even though footer file is loaded at the bottom.

It works fine if its CodeIgniter only. But when I include XenForo autoloader in the constructor it doesn't (no matter which version except native 5.3).

It works fine if PHP version is native 5.3 with CI and XenForo both together. Not with 5.3, 5.4, 5.5 or 5.6.

Any help will be appreciated.

Regards,
Puneet
 
Locate the function that outputs the header, index and footer and debug how it behaves when you include the XenForo library. Could be something related to the output buffer but I wouldn't be sure without taking a look at the code.
 
Locate the function that outputs the header, index and footer and debug how it behaves when you include the XenForo library. Could be something related to the output buffer but I wouldn't be sure without taking a look at the code.

Thanks for the advice mate! I found the issue.
ob_get_level() function returns 1 instead of 0 thus interrupt the loading process.

Adding this to index.php file solved the issue:
Code:
if (ob_get_level()) ob_end_clean();
 
Top Bottom