The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Bad Behavior 2.0.27: Error "Warning: preg_replace()" (2 posts)

  1. Alvaro Degives-Mas
    Posted 7 years ago #

    Just upgraded to BB 2.0.27 and suddenly I get these:

    Warning: preg_replace() [function.preg-replace]: No ending delimiter '^' found in /path/to/plugins/bad-behavior/bad-behavior/core.inc.php on line 114

    Warning: Cannot modify header information - headers already sent by (output started at /path/to/plugins/bad-behavior/bad-behavior/core.inc.php:114) in /path/to/plugins/bad-behavior/bad-behavior/screener.inc.php on line 8

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /path/to/plugins/bad-behavior/bad-behavior/core.inc.php:114) in /path/to/plugins/enhanced-wordpress-contactform/wp-contactform.php on line 247

    Tried deleting the old (2.0.26) BB folder and upping the new version via FTP but no dice.

    I suppose the issue is a missing regex delimiter, but, uh, I'm not very good at this PHP / RegEx stuff...

    Help much appreciated!

  2. Alvaro Degives-Mas
    Posted 7 years ago #

    Aha! Thanks to Jonathan Lundell's tip posted at the Bad Behavior author's site, the solution is not only available but also very simple to apply.

    Just go to line 114 of the file core.inc.php (it's within the "secondary" plugin's sub-folder, which is also named bad-behavior!) and substitute that line with the following:
    $_SERVER['REMOTE_ADDR'] = preg_replace("/^::ffff:/", "", $_SERVER['REMOTE_ADDR']);
    Problem solved!

Topic Closed

This topic has been closed to new replies.

About this Topic