View Full Version : Post character limit(24998) after switch to PHP5
Idealist
10-16-2007, 06:49 PM
Ever since switching from PHP 4 to 5 new posts and edits that aren't done via quick edit end up blank if they're more than 24998 characters. I've had to place a limit on post size via the "Maximum Characters Per Post" setting, so users won't lose edits or new posts.
Here's a bit of info about the forum/server:
CENTOS Enterprise 4.4 i686
Apache 1.3.39
PHP 5.2.4
MySQL 4.0.27
vB 3.5.4 with security patches
There've been no errors reported by PHP or in the server's error_log. I've tried on a test instance of vB without any plugins and the same happens. Any ideas?
Marco van Herwaarden
10-17-2007, 05:59 AM
Please enable Public PHPInfo in your vBuletin Options and provide a link to your board.
Idealist
10-17-2007, 02:13 PM
<a href="http://sleepywood.net/forum/" target="_blank">http://sleepywood.net/forum/</a>
You'll see APC enabled, but the test forum had it disabled and still had the problem.
Marco van Herwaarden
10-17-2007, 05:11 PM
Try increasing the 'post_max_size' in your PHP config. Other then that, i don't see anything obvious.
Paul M
10-17-2007, 05:15 PM
25,000 chars is rather a lot, I would have though that limiting posts to (a lot) less than that would be sensible anyway.
Idealist
10-17-2007, 07:04 PM
PHP would've logged an error if it exceeded post_max_size.
I thought 20k was enough after I noticed the blanking, but then the users got antsy about it. Think I'll look at what handles the quick edits compared to normal edits and see if I can fix this myself.
I'll post about it on success.
--------------- Added 1192684620 at 1192684620 ---------------
Found it! It failed at:
function strip_empty_bbcode($text)
{
return preg_replace('#(^.*|.*)(\[(php|html|noparse)\].*\[/\\3])(.*|.*$)#siUe', "\$this->strip_empty_bbcode_callback('\\1', '\\2', '\\4')", $text);
}
strip_empty_bbcode ended up causing the script to hit the pcre.backtrack_limit and/or pcre.recursion_limit (http://php.net/pcre#pcre.configuration) settings yet not logging an error.
I suggest having the option to set these in the vB AdminCP, or just correlate the setting to the "Maximum Characters Per Post" setting. The quickest solution is an:
ini_set('pcre.backtrack_limit', '-1');
ini_set('pcre.recursion_limit', '-1');
At the top of class_dm.php.
Marco van Herwaarden
10-18-2007, 05:35 AM
Very nice find, how did you find this if it was not logged?
Marco van Herwaarden
10-18-2007, 10:24 AM
I had a short chat with one of our developers on this subject, and it is known that this can happen in PHP 5.2, and a workaround has been added since 3.5.8 & 3.6.5.
My advice is to upgrade to a newer vBulletin version.
Idealist
10-18-2007, 02:51 PM
Very nice find, how did you find this if it was not logged?
error_log()'ing at each point the message was changed. Took a moderate amount of time, I hoped it'd be quicker and dreaded it'd being longer.
I had a short chat with one of our developers on this subject, and it is known that this can happen in PHP 5.2, and a workaround has been added since 3.5.8 & 3.6.5.
My advice is to upgrade to a newer vBulletin version.My forum is very customized, the work I did finding this is less than checking each bit of customization. But a fine suggestion for others with this problem that don't want to screw with php.ini settings.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.