Index: trunk/extensions/SpamBlacklist/SpamBlacklist_body.php |
— | — | @@ -413,6 +413,13 @@ |
414 | 414 | $regexEnd = ($batchSize > 0 ) ? ')/Si' : ')/i'; |
415 | 415 | $build = false; |
416 | 416 | foreach( $lines as $line ) { |
| 417 | + if( substr( $line, -1, 1 ) == "\\" ) { |
| 418 | + // Final \ will break silently on the batched regexes. |
| 419 | + // Skip it here to avoid breaking the next line; |
| 420 | + // warnings from getBadLines() will still trigger on |
| 421 | + // edit to keep new ones from floating in. |
| 422 | + continue; |
| 423 | + } |
417 | 424 | // FIXME: not very robust size check, but should work. :) |
418 | 425 | if( $build === false ) { |
419 | 426 | $build = $line; |
— | — | @@ -497,13 +504,22 @@ |
498 | 505 | */ |
499 | 506 | static function getBadLines( $lines ) { |
500 | 507 | $lines = SpamRegexBatch::stripLines( $lines ); |
| 508 | + |
| 509 | + $badLines = array(); |
| 510 | + foreach( $lines as $line ) { |
| 511 | + if( substr( $line, -1, 1 ) == "\\" ) { |
| 512 | + // Final \ will break silently on the batched regexes. |
| 513 | + $badLines[] = $line; |
| 514 | + } |
| 515 | + } |
| 516 | + |
501 | 517 | $regexes = SpamRegexBatch::buildRegexes( $lines ); |
502 | 518 | if( SpamRegexBatch::validateRegexes( $regexes ) ) { |
503 | | - // No problems! |
504 | | - return array(); |
| 519 | + // No other problems! |
| 520 | + return $badLines; |
505 | 521 | } |
506 | 522 | |
507 | | - $badLines = array(); |
| 523 | + // Something failed in the batch, so check them one by one. |
508 | 524 | foreach( $lines as $line ) { |
509 | 525 | $regexes = SpamRegexBatch::buildRegexes( array( $line ) ); |
510 | 526 | if( !SpamRegexBatch::validateRegexes( $regexes ) ) { |