php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7257 RegEx kills String
Submitted: 2000-10-16 15:29 UTC Modified: 2000-10-23 05:21 UTC
From: hoglabogla at hotmail dot com Assigned:
Status: Closed Package: *Regular Expressions
PHP Version: 4.0.3pl1 OS: Redhat Linux 7.0
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:
31 + 5 = ?
Subscribe to this entry?

 
 [2000-10-16 15:29 UTC] hoglabogla at hotmail dot com
$mask= "anything";
$mask= preg_replace("/\\/", "/a/", $mask);

if( $mask ) 
  echo "Empty? Hu? PHP-Bug?";
else
  echo "OK";

The preg_replace kills $mask, witch it shouldn't, i guess

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-16 15:31 UTC] hoglabogla at hotmail dot com
Ooops! The other way round, of course:

if( $mask ) 
  echo "OK";
else
  echo "Empty? Hu? PHP-Bug?";

 [2000-10-23 05:21 UTC] stas@php.net
Your regexp is wrong - it is passed to Perl as /\/, which is lacking the ending /. Since regexp is bad, NULL is returned, and that's what you get in $mask.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 19:01:29 2024 UTC