com web/news: Use strpos() to check for @-symbol instead of deprecated ereg(): common.php
| From: | Ferenc Kovacs | Date: | Tue, 05 Jan 2016 23:47:46 +0000 |
| Subject: | com web/news: Use strpos() to check for @-symbol instead of deprecated ereg(): common.php | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-24430@lists.php.net to get a copy of this message | ||
Commit: aae3e0e43338be6c026c7a0eccc718f19d96c0ce
Author: Ben Ramsey <ben@benramsey.com> Tue, 5 Jan 2016 17:40:17 -0600
Parents: ab6f7b782082a7d527c2b007d0a121f4022e1947
Branches: master
Link: http://git.php.net/?p=web/news.git;a=commitdiff;h=aae3e0e43338be6c026c7a0eccc718f19d96c0ce
Log:
Use strpos() to check for @-symbol instead of deprecated ereg()
Changed paths:
M common.php
Diff:
diff --git a/common.php b/common.php
index a6293d7..979c98a 100644
--- a/common.php
+++ b/common.php
@@ -126,7 +126,7 @@ function format_author($a, $charset) {
if (preg_match("/^\s*\"?(.+?)\"?\s*<(.+)>\s*$/",$a,$ar)) {
return "<a href=\"mailto:".htmlspecialchars(urlencode(spam_protect($ar[2])),
ENT_QUOTES, "UTF-8")."\" class=\"email fn
n\">".str_replace(" ", " ", htmlspecialchars($ar[1],
ENT_QUOTES, "UTF-8"))."</a>";
}
- if (ereg("@",$a)) {
+ if (strpos("@",$a) !== false) {
$a = spam_protect($a);
return "<a href=\"mailto:".htmlspecialchars(urlencode($a),
ENT_QUOTES, "UTF-8")."\" class=\"email fn
n\">".htmlspecialchars($a, ENT_QUOTES, "UTF-8")."</a>";
}