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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC