php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8129 ereg returns incorrect results
Submitted: 2000-12-05 18:15 UTC Modified: 2001-01-28 18:35 UTC
From: scion at webrelay dot net Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 4.0.3pl1 OS: Solaris 2.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: scion at webrelay dot net
New email:
PHP Version: OS:

 

 [2000-12-05 18:15 UTC] scion at webrelay dot net
<?php

$str[] = "Makefile";
$str[] = "makefile";
$str[] = "..";
$str[] = "X-picturev";

$regexp = "^[a-z]";

while ( list( $key, $e) = each($str) ){

        if( ereg( $e, $regexp))
                echo "$e is lower<br>";
        else
                echo "$e is UPPER<br>";
}
?>

confugured --regex=pcre
http://tbiz.webrelay.net/test/ereg.php  will illustrate the 
bug and show phpinfo();

Also php4.0pl1 with OpenBSD with -regex=php will behave similarly.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-05 18:22 UTC] zak@php.net
The same code works as expected for me - and I have used similar code on oBSD.

Please doublecheck your code. Perhaps the regex is actually '[^a-z]'?
 [2001-01-08 18:47 UTC] avsm@php.net
Is this bug still present in php-4.0.4?
 [2001-01-28 18:35 UTC] sniper@php.net
the script is buggy: 

ereg($e, $regexp) should be ereg($regexp, $e)

--Jani
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Nov 29 08:01:23 2020 UTC