JSMF in Wrapped mode and unreadable topics - poss. solutions

Discuss the integration of SMF here.
Locked
daclina
Joomla! Apprentice
Joomla! Apprentice
Posts: 9
Joined: Sun May 13, 2007 2:31 pm

JSMF in Wrapped mode and unreadable topics - poss. solutions

Post by daclina » Wed Jun 18, 2008 4:23 pm

I have read about this problem over and over again - it happened to me as well. My setup was:

J!1.12
CB 1.1
SMF 1.1.2
JSMF 2.0

Everything was fine until suddenly any topic that had more than 1 page was not showing up (people have experienced funny other issues too). I went around hunting for solutions but nothing helped. It seems as it is an issues with the php 5.2.5 upgrade - almost everybody who has experienced this is because of the upgrade.

My 1st instinct was to take the time to upgrade J!1.15, and SMF to 1.1.4 and use the new JSMF 2.0.21a bridge - that didn't help.

Solution 1: (didn't work for me because not all shared hosts allow this)

.htaccess

add the following line to switch to php 5.1

Code: Select all

AddHandler application/x-httpd-php51 .php .php5 .php4 .php3
Soluiton 2: (also didn't work for me)

Simply go to the Admin section of SMF - Posts and Topics, and change your posts displayed per page to something lower (play with the values, apparently results vary)

Solution 3: (this worked for me :))

Open smf.class.php in /components/com_smf

find:

Code: Select all

$regex = array('/<!DOCTYPE.*<body>/smi', '/<\/body>/i', '/<\/html>/i');
$buffer = preg_replace($regex, array('', '', ''), $buffer);
unset($matches, $keywords, $css, $search, $replace, $headers, $regex);
replace with:

Code: Select all

//Regex broken with PHP 5.2.5           
//$regex = array('/<!DOCTYPE.*<body>/smi', '/<\/body>/i', '/<\/html>/i');
//$buffer = preg_replace($regex, array('', '', ''), $buffer);
//unset($matches, $keywords, $css, $search, $replace, $headers, $regex);
$needle = '<body>';
$buffer = strstr($buffer, $needle);
$buffer = substr($buffer, strlen($needle));
$regex = array('/<\/body>/i', '/<\/html>/i');
$buffer = preg_replace($regex, array('', ''), $buffer);
unset($matches, $keywords, $css, $search, $replace, $headers, $regex, $needle);
The explanation for this was:
"it is related to the new php 5.2.5 versions regular expression library. most isps have recently updated. either this is a bug or something they have changed in how the regexes are evaluated"
Joomlahacks seems to be down atm hence why I have put together the above-list of suggested fixes - 1 worked for me, hopefully this will work for some of you too.

Good Luck

PS. I am not sure if I am breaking any SMF licenses here - if I am plz feel free to delete this post.

Locked

Return to “SMF - Simplemachines.org Forum”