* [mlmmj] [PATCH] ereg() removed in PHP 7.0
@ 2016-05-24 17:21 Chris Knadle
0 siblings, 0 replies; only message in thread
From: Chris Knadle @ 2016-05-24 17:21 UTC (permalink / raw)
To: mlmmj
[-- Attachment #1.1.1: Type: text/plain, Size: 735 bytes --]
Debian is transitioning from PHP 5 to PHP 7.0, and PHP 5 is soon to be
removed. The current mlmmj PHP code has 2 to calls to ereg() functions
which were deprecated in PHP 5.3.0 and removed from PHP 7.0.0, thus
requiring modification. Attached is a patch that does this.
Note that the regex in contrib/web/php-user/mlmmj.php for matching email
addresses could also use updating to allow for the full range of special
characters that are allowed in email addresses:
https://tools.ietf.org/html/rfc5322#section-3.4.1
Right now it looks like these special characters might not be accepted by
the regex AFAICT:
! # $ % & ' * + / = ? ^ ` { | } ~
Thanks
-- Chris
--
Chris Knadle
Chris.Knadle@coredump.us
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1.2: 06_fix-php-web-for-php7.diff --]
[-- Type: text/x-diff; name="06_fix-php-web-for-php7.diff", Size: 1421 bytes --]
Description: Update for PHP 5 -> PHP 7 transition
ereg() and eregi() were deprecated with PHP 5.3.0 and removed in PHP 7.0.0
https://secure.php.net/manual/en/function.ereg.php
https://secure.php.net/manual/en/function.eregi.php
Also remove min 2, max 4 character TLD portion of regex, as there are
top-level domains > 4 chars now.
Thanks to Ron Guerin <ron@vnetworx.net> for his help with the PHP regexes.
Author: Christopher Knadle <Chris.Knadle@coredump.us>
Bug-Debian: https://bugs.debian.org/821532
Bug-Debian: https://bugs.debian.org/821533
Last-Updated: 2016-05-22
--- a/contrib/web/php-user/mlmmj.php
+++ b/contrib/web/php-user/mlmmj.php
@@ -37,7 +37,7 @@
function is_email($string="")
{
- if (eregi("^[a-z0-9\._-]+".chr(64)."+[a-z0-9\._-]+\.+[a-z]{2,4}$", $string))
+ if (preg_match(chr(7)."^[a-z0-9\._-]+@+[a-z0-9\._-]+\.+[a-z]+$".chr(7).'i', $string))
{
return TRUE;
}
--- a/contrib/web/php-admin/htdocs/index.php
+++ b/contrib/web/php-admin/htdocs/index.php
@@ -37,7 +37,7 @@
# use scandir to have alphabetical order
foreach (scandir($topdir) as $file) {
- if (!ereg("^\.",$file))
+ if (substr($file,0,1) != '.')
{
$lists .= "<p>".htmlentities($file)."<br/>\n";
$lists .= "<a href=\"edit.php?list=".urlencode($file)."\">Config</a> - <a href=\"subscribers.php?list=".urlencode($file)."\">Subscribers</a>\n";
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-05-24 17:21 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-24 17:21 [mlmmj] [PATCH] ereg() removed in PHP 7.0 Chris Knadle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox