Author: Christoph M. Becker (cmb69)
Date: 2022-08-05T18:29:15+02:00

Commit: 
https://github.com/php/web-master/commit/b056f4275ad8259269c6d419d4589cbd3e3071c1
Raw diff: 
https://github.com/php/web-master/commit/b056f4275ad8259269c6d419d4589cbd3e3071c1.diff

Also count https:// URLs

Might not make much sense nowadays to count `http://` URLs, but not
checking `https://` is certainly unhelpful.

Changed paths:
  M  include/spam-lib.inc


Diff:

diff --git a/include/spam-lib.inc b/include/spam-lib.inc
index c6fee11..14eeb1f 100644
--- a/include/spam-lib.inc
+++ b/include/spam-lib.inc
@@ -73,7 +73,7 @@ function check_spam_urls ($text, $httplimit = 4) {
     if (preg_match('/\[(url|link)=[^]]+\]/', $text)) {
         return true;
     }
-    if (substr_count($text, 'http://') >= $httplimit) {
+    if ((int) preg_match_all('~http(?:s)?://~', $text) >= $httplimit) {
         return true;
     }
     return false;

-- 
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to