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
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: 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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Wed Jan 15 10:01:29 2025 UTC