|  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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: scion at webrelay dot net
New email:
PHP Version: OS:


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

$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>";
                echo "$e is UPPER<br>";

confugured --regex=pcre  will illustrate the 
bug and show phpinfo();

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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-05 18:22 UTC]
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]
Is this bug still present in php-4.0.4?
 [2001-01-28 18:35 UTC]
the script is buggy: 

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

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 01:01:32 2024 UTC