From: Chris Knadle <Chris.Knadle@coredump.us>
To: mlmmj@mlmmj.org
Subject: [mlmmj] [PATCH] ereg() removed in PHP 7.0
Date: Tue, 24 May 2016 17:21:07 +0000 [thread overview]
Message-ID: <57448D83.1090009@coredump.us> (raw)
[-- 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 --]
reply other threads:[~2016-05-24 17:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57448D83.1090009@coredump.us \
--to=chris.knadle@coredump.us \
--cc=mlmmj@mlmmj.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).