php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #41499 ereg with null
Submitted: 2007-05-25 14:23 UTC Modified: 2007-05-25 16:16 UTC
From: henrique at webcoder dot com dot br Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.4.7 OS: Debian Etch
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: henrique at webcoder dot com dot br
New email:
PHP Version: OS:

 

 [2007-05-25 14:23 UTC] henrique at webcoder dot com dot br
Description:
------------
Hi!

Value %00 in the end of the regular expression is sent and the function ereg() disrespects the remaining portion all. 

Tested in the PHP 4.4.4-8+etch1 

Thank you!

Henrique

Reproduce code:
---------------
function validateGender($gender)
{
	return (ereg("^[MF]$", $gender)) ? $gender : false;
}

print "Gender: ". validateGender($_GET['gender']);

Expected result:
----------------
?gender=M%00<b>test</b>

Gender:

Actual result:
--------------
?gender=M%00<b>test</b>

Gender:M&#65533;test

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-05-25 16:16 UTC] johannes@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

\"Warning

These regular expression functions are not binary-safe. The PCRE functions are. \"
http://php.net/regex
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 19:01:31 2024 UTC