Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 54373 - Regular expression returns different results with the same input
Regular expression returns different results with the same input
Product: Red Hat Linux
Classification: Retired
Component: php (Show other bugs)
i386 Linux
high Severity medium
: ---
: ---
Assigned To: Phil Copeland
David Lawrence
: Security
Depends On:
  Show dependency treegraph
Reported: 2001-10-04 20:21 EDT by Joerg Ludwig
Modified: 2007-03-26 23:49 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-12-07 21:02:18 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Joerg Ludwig 2001-10-04 20:21:43 EDT
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:

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-07 21:02:14 EST
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.