Bug 54373 - Regular expression returns different results with the same input
Summary: Regular expression returns different results with the same input
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: php
Version: 7.1
Hardware: i386
OS: Linux
high
medium
Target Milestone: ---
Assignee: Phil Copeland
QA Contact: David Lawrence
URL: http://iserv-bs.de/regex.php
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-10-05 00:21 UTC by Joerg Ludwig
Modified: 2007-03-27 03:49 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2001-12-08 02:02:18 UTC
Embargoed:


Attachments (Terms of Use)

Description Joerg Ludwig 2001-10-05 00:21:43 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)

Description of problem:
The same regular expression with exactly the same input returns sometimes 
true and sometimes false!

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
Run this PHP Script several times:
<?
echo ereg("^[A-Za-z0-9]+$", "abc")? 1: 0;
?>

Actual Results:  It sometimes returns 0, sometimes 1.

Expected Results:  It should *always* return 1!

Additional info:

This bug is very unclear to me, because only minor changes to the regular 
expression make the script work as expected.

The problem does not occur with the Perl-Compatible Regular Expression 
Functions (preg*).

As the bug also occurs in Apache's mod_rewrite, I think, it is not directy 
related to PHP, but a gerneral Linux problem. The following rewrite rule 
returns different results with exactly the same input:
RewriteCond	%{HTTP_HOST}	[a-z]

This bug is a security risk, because regular expressions will not always 
work as expected!

I use the newest rpms available via "up2date -uf".

Comment 1 Joerg Ludwig 2001-12-08 02:02:14 UTC
I cannot reproduce this bug anymore... maybe it was fixed by one of the 
up2date-updates :)


Note You need to log in before you can comment on or make changes to this bug.