Edit report at https://bugs.php.net/bug.php?id=60903&edit=1

 ID:                 60903
 Updated by:         fel...@php.net
 Reported by:        gohanman at gmail dot com
 Summary:            preg_match + operator fails with string exceeding
                     length 18
-Status:             Open
+Status:             Not a bug
 Type:               Bug
-Package:            Regexps related
+Package:            PCRE related
 Operating System:   Ubuntu
 PHP Version:        5.3.9
 Block user comment: N
 Private report:     N

 New Comment:

Are you really using 5.3.9 with the built-in PCRE library?
Your test case works just fine here.

If it returns false, you can check preg_last_error() and adjust the INI 
configuration accordingly. About crashing, it's known behavior from PCRE 
library, take a look at the PCRE documentation for more information.


Previous Comments:
------------------------------------------------------------------------
[2012-01-27 15:50:53] gohanman at gmail dot com

Description:
------------
I'm trying to validate email addresses via regular expression. My regular 
expression fails if the first domain portion is longer than 18 characters. 
Overall string length does not seem relevant. Decreasing the length of the user 
portion or TLD does not make a 19+ character domain portion work.

Test script:
---------------
function is_email($str){
        
if(preg_match("/^[_a-z0-9-]+(.[_a-z0-9-]+)*@[a-z0-9-]+(.[a-z0-9-]+)*(.[a-z]{2,4})$/i",
 $str))
                return True;
        return False;
}

var_dump(is_email("u...@123456789012345678.com"));
var_dump(is_email("u...@1234567890123456789.com"));

Expected result:
----------------
bool(true);
bool(true);

Actual result:
--------------
bool(true);
bool(false);


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=60903&edit=1

Reply via email to