Bug 54373 - Regular expression returns different results with the same input
Summary: Regular expression returns different results with the same input
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: php (Show other bugs)
(Show other bugs)
Version: 7.1
Hardware: i386 Linux
high
medium
Target Milestone: ---
Assignee: Phil Copeland
QA Contact: David Lawrence
URL: http://iserv-bs.de/regex.php
Whiteboard:
Keywords: Security
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:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2001-12-08 02:02:18 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


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.