Bug #862 [Com]: problem in eregi()
| From: | asghhs at gmail dot com | Date: | Mon, 06 Mar 2023 07:15:33 +0000 |
| Subject: | Bug #862 [Com]: problem in eregi() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-243854@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=862&edit=1
ID: 862
Comment by: asghhs at gmail dot com
Reported by: markjr at easyDNS dot com
Summary: problem in eregi()
Status: Closed
Type: Bug
Package: Misbehaving function
Operating System: linux 2.0.35
PHP Version: 3.0.5
Block user comment: N
Private report: N
New Comment:
MYHR KOHLS is an online portal that enables Kohl's employees to access their HR information and
manage their benefits. This portal provides employees with a convenient way to view and manage their
payroll, vacation time, health benefits, and other HR related information. It also allows them to
access a variety of tools such as tax forms, pension plans, and more. MYHR KOHLS is a great tool for
employers as it helps them keep track of employee information in one place. It also simplifies the
process of managing employee benefits and payrolls.
(https://myhrwork.com/kohls/myhr-kohls-login/)github.com
Previous Comments:
------------------------------------------------------------------------
[1998-10-29 22:04:03] rasmus
You have a number of problems in your regular expressions there. First, there is no such thing as
\- and even if there was you would have to write it as \\- because inside a double-quoted string in
PHP escape chars are parsed. In order to get the eregi() function to see \- you would have to
escape the \ and thus have \\-. That isn't you problem though. I quote from the Extended
Regular Expression docs (see regex/regex.7 in the PHP distribution):
To include a literal `]' in the list, make it the first
character (following a possible `^'). To include a lit-
eral `-', make it the first or last character, or the sec-
ond endpoint of a range. To use a literal `-' as the
first endpoint of a range, enclose it in
[.' and .]' to
make it a collating element (see below). With the excep-
tion of these and some combinations using `[' (see next
paragraphs), all other special characters, including `\',
lose their special significance within a bracket expres-
sion.
So, this tells you that you cannot put a '-' in the middle of a range like that. I do not
think this is a bug in PHP. PHP's behaviour is entirely consistent with that definition.
------------------------------------------------------------------------
[1998-10-20 17:17:33] markjr at easyDNS dot com
eregi("[^a-z0-9\.\-]", "test-ing") returns false
eregi("[^a-z0-9\-\.]", "test-ing") returns true
Switching the escaped "." and "-" causes the
pattern to fail erroneously. The behaviour goes
away if you use an inclusive regex (read:
lose the "^")
here's a short script to test with
<?
function isValidAddr ($addr) {
if(eregi("[^a-z0-9\-\.]",$addr)):
return(false);
else:
return(true);
endif;
};
echo isValidAddr("Tesdt-jkjk") ? "true" : "false";
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=862&edit=1