Re: PHP Deprecated: Function eregi() is deprecated

Paul Lesniewski <[email protected]> Sat, 17 Jan 2015 18:11:54 -0800
Newsgroups gmane.mail.squirrelmail.plugins
Message-ID <CAHog11696wqPyd0WEUhaQ3SymYHnn+NtHQROgfBOz=mLP0AONA@mail.gmail.com>
> PHP Deprecated:  Function eregi() is deprecated in
> /home/webmail/src/squirrelmail/plugins/add_address/functions.php on line
> 718, referer: [...]
>
> --- a/plugins/add_address/functions.php
> +++ b/plugins/add_address/functions.php
> @@ -715,7 +715,7 @@ function aa_validate_email($email, $verify)
>
>     // check formatting
>     //
> -   if (!eregi('^' . $Email_RegExp_Match . '$', $email))
> +   if (!preg_match('/^' . addcslashes($Email_RegExp_Match, '/') .
> '$/i', $email))
>        return FALSE;
>
>
> Is this correct? Any caveats regarding this solution?

I don't think you need addcslashes.  This should do the job:

if (!preg_match('/^' . $Email_RegExp_Match . '$/i', $email))

-- 
Paul Lesniewski
SquirrelMail Team
Please support Open Source Software by donating to SquirrelMail!
http://squirrelmail.org/donate_paul_lesniewski.php

------------------------------------------------------------------------------
New Year. New Location. New Benefits. New Data Center in Ashburn, VA.
GigeNET is offering a free month of service with a new server in Ashburn.
Choose from 2 high performing configs, both with 100TB of bandwidth.
Higher redundancy.Lower latency.Increased capacity.Completely compliant.
http://p.sf.net/sfu/gigenet
-----
squirrelmail-plugins mailing list
Posting guidelines: http://squirrelmail.org/postingguidelines
List address: [email protected]
List archives: http://news.gmane.org/gmane.mail.squirrelmail.plugins
List info (subscribe/unsubscribe/change options): https://lists.sourceforge.net/lists/listinfo/squirrelmail-plugins