php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39857 Ereg(i) returns irrelevant result
Submitted: 2006-12-17 00:03 UTC Modified: 2006-12-18 00:37 UTC
From: adult at adult-inc dot biz Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 5.2.0 OS: Fedora core 5
Private report: No CVE-ID: None
 [2006-12-17 00:03 UTC] adult at adult-inc dot biz
Description:
------------
Ereg and eregi functions returns irrelevant results

Reproduce code:
---------------
if (ereg("[9876543210]{2,6}", "2006-12-17"))
	echo "BUG";
else
	echo "OK";

Expected result:
----------------
OK

Actual result:
--------------
BUG

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-17 18:27 UTC] iliaa@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

your regex allow for 2 numbers tom be matched. So it matches 
20 and returns TRUE indicating success.
 [2006-12-18 00:37 UTC] adult at adult-inc dot biz
Sorry, had a hard work that day :)
That's what i need: ereg("[^0-9$]{2,6}", "2006-12-17")
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Sat May 28 04:06:34 2022 UTC