#29039 [Opn->WFx]: ereg {0,255} limited to 255 ... and not documented
| From: | nlopess@php.net | Date: | Thu, 08 Jul 2004 11:19:54 +0000 |
| Subject: | #29039 [Opn->WFx]: ereg {0,255} limited to 255 ... and not documented | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969361762@lists.php.net to get a copy of this message | ||
ID: 29039
Updated by: nlopess@php.net
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 <didou@keliglia.com>
---------------
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 couldnt figure out
why I was getting an error. Theres 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
info@SmithfieldEntertainment.com
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