php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #16590 Problems with strings containing \x00
Submitted: 2002-04-13 13:06 UTC Modified: 2002-05-24 15:20 UTC
From: daniel at lorch dot cc Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.1.2 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
14 - 7 = ?
Subscribe to this entry?

 
 [2002-04-13 13:06 UTC] daniel at lorch dot cc
The PCRE has problems with strings containing 0x00. It stops reading as if the strings were \0 terminated. This affects all preg_* functions.

Examples:

  preg_match("/\x00/", "foo");
  preg_match("/" . chr(0) . "/", "foo");

Raises the error "Warning: No ending delimiter '/' found"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-04-13 13:23 UTC] daniel@php.net
Actually, I'm not sure whether this problem can be solved as it is PCRE and not a PHP specific (and it can't be solved without breaking compatibilty with languages using 0 terminated strings such as C).

I'm thinking about making it a documentation problem. What do you guys think?

-daniel
 [2002-04-13 15:59 UTC] sander@php.net
The docs state that PCRE is binary safe. So this might be a bug after all...
 [2002-04-13 16:27 UTC] jimw@php.net
pcre is binary safe with regards to the string being matched against, but not the pattern. this is a limitation of the pcre library itself, not just the php interface. you can specify the nul character using:

preg_match("/\\x00/", "foo\0bar")

reclassified as documentation problem.
 [2002-05-24 15:20 UTC] derick@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 08:01:29 2024 UTC