[mlmmj] [PATCH] ereg() removed in PHP 7.0

Chris Knadle <[email protected]>
Newsgroups org.mlmmj.mlmmj
Message-ID <[email protected]>
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
[email protected]
06_fix-php-web-for-php7.diff (text/x-diff, 1.4 KB)
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 <[email protected]> for his help with the PHP regexes.
Author: Christopher Knadle <[email protected]>
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";
signature.asc (application/pgp-signature, 801 B)
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJXRI2HAAoJEEkSKbZEGfmqhEoP/19H99MASNCfrTFTWaF78dej
jqib3WwvL2GYAYxoS6VxYdvCfWi5LpUJC3lDuPbYe9Yu5JjF+f5X5JhpzQYtpQje
YyrvVIBEY9So53zhRJlinM0tN0KcSJfGjwpebOx50Jz9p4yqCvuAEYgEm2/49S+9
qgyYJITFcBBB/I0lqHHomHZBTwz8oVSvF2MmYdL8uNX0uaTpBIUnk9xcdX518T9Y
4BVX3flCtFvIKjr5lFOj1x1YmMfEYP3gNxhCoZ2+tF00UqS3YTFLGhKkHNCvx2rq
b5wDtZxabzEJWePGvWMcb1h68Jppt+zFKI+0z10RIGpyd23DPjeZY8SYRuKi5QZJ
9LIpQlCPmyjeHmGVqtnr88wCorA9BVznc32Ch30YDHmh7T5igm5KvoIVFMzAfy5w
oNtXR/S+OW1fcLHEpYlRw73ioMFM9HHtLtLKegs3y8Wg24Ur+cvGCqTHpFKkSSai
5Z0a+4MISwRIx4WH2GT9CNffBF6rlgBfvdmHiRPloqnXjwkFbGjskwiv27qOmF6S
dO57eSXuoUkFGoyUlOwDpIFZY/k+k0sXvPrl3zfFOlBs4hiLAYn/fYS45DcDsxkT
Tkv0oTw8EfP4WeP0D0+zhmDsKhSmxGEp8LfA/54EZS0MZVt65UlBhccf5uIAxFNR
SaicMoZUO1b4ti/+787W
=+1zY
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.