Author: Nikita Popov (nikic)
Date: 2023-06-24T21:19:47+02:00

Commit: 
https://github.com/php/web-bugs/commit/717f16a6d9c1a309a5ea5dad78a7a0ab0ce97429
Raw diff: 
https://github.com/php/web-bugs/commit/717f16a6d9c1a309a5ea5dad78a7a0ab0ce97429.diff

Make spam filter stricter

Require that php.net/github.com is in the host portion.

Changed paths:
  M  include/functions.php


Diff:

diff --git a/include/functions.php b/include/functions.php
index 9b37d60b..2f70bb7b 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -197,7 +197,7 @@ function is_spam($string)
 
     if (preg_match_all('/https?:\/\/(\S+)/', $string, $matches)) {
         foreach ($matches[1] as $match) {
-            if (strpos($match, 'php.net') === false && strpos($match, 
'github.com') === false) {
+            if (!preg_match('/^[^\/]*(php\.net|github\.com)/', $match)) {
                 return "Due to large amounts of spam, only links to php.net 
and github.com (including subdomains like gist.github.com) are allowed.";
             }
         }

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

Reply via email to