ID: 29039 Updated by: [EMAIL PROTECTED] Reported By: info at smithfieldentertainment dot com -Status: Open +Status: Wont fix Bug Type: Documentation problem Operating System: UNIX PHP Version: Irrelevant New Comment:
We have discussed this and we decided not to document this behaviour, has this is cleary explained in the man page. Previous Comments: ------------------------------------------------------------------------ [2004-07-06 23:41:14] info at smithfieldentertainment dot com Description: ------------ I sent the following email to Mehdi Achour <[EMAIL PROTECTED]> --------------- Hi, I discovered (the hard way after hours of code troubleshooting) that ereg/eregi/etc. functions have a very useful but LIMITED length function. It seems that while the ereg functions will search for matches in (any?) length code, the length limiter {0, 255} is limited to 255. I was trying to match lengths of 350 and 800… but couldn’t figure out why I was getting an error. There’s no documentation on this anywhere that I could find. Please add it to all applicable regular expression match items that it applies to. Thanks! -- CJ Greiner [EMAIL PROTECTED] http://www.SmithfieldEntertainment.com 757-356-1166 Reproduce code: --------------- if (eregi("^([a-z0-9 $&*?\'.-]{100,300})$", $register_data[register_summary], $ereg_results) == FALSE) { $error_message .= '<br>Subject Summary: Please use only letters, numbers, and punctuation: \'-$&*?<br>'; } Expected result: ---------------- if the user input $register_data[register_summary] does not match the regular expression OR is ouside the acceptable length range of 100-300 letters, then the expression should return FALSE and assign an $error_message. Actual result: -------------- Even when the user input for $register_data[register_summary] had acceptable characters AND had acceptable lengths... The code failed because the max length of 300 {100, 300} was causing a FALSE or FAIL. I experimented with the length until I brought it down to 255... then it worked. This limit is not documented anywhere. There should be no limit... or at least a much higher limit, since the matching expression will work on a much longer string if no length limit is placed in it. Thanks! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29039&edit=1