iliaa           Thu Jan 15 21:31:27 2004 EDT

  Added files:                 (Branch: PHP_4_3)
    /php-src/ext/pcre/tests     bug26927.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/pcre   php_pcre.c 
  Log:
  MFH: Fixed Bug #26927 (preg_quote() does not escape \0).
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.526 php-src/NEWS:1.1247.2.527
--- php-src/NEWS:1.1247.2.526   Wed Jan 14 19:36:08 2004
+++ php-src/NEWS        Thu Jan 15 21:31:25 2004
@@ -1,6 +1,7 @@
 PHP 4                                                                      NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Jan 2004, Version 4.3.5
+- Fixed Bug #26927 (preg_quote() does not escape \0). (Ilia)
 - Fixed bug #26909 (crash in imap_mime_header_decode() when no encoding is 
   used). (Ilia)
 - Fixed bug #26878 (problem with multiple references to the same variable 
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.132.2.13 php-src/ext/pcre/php_pcre.c:1.132.2.14
--- php-src/ext/pcre/php_pcre.c:1.132.2.13      Tue Dec 16 16:55:22 2003
+++ php-src/ext/pcre/php_pcre.c Thu Jan 15 21:31:26 2004
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_pcre.c,v 1.132.2.13 2003/12/16 21:55:22 andrei Exp $ */
+/* $Id: php_pcre.c,v 1.132.2.14 2004/01/16 02:31:26 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1391,6 +1391,11 @@
                                *q++ = c;
                                break;
 
+                       case '\0':
+                               *q++ = '\\';
+                               *q++ = '0';
+                               break;
+
                        default:
                                if (quote_delim && c == delim_char)
                                        *q++ = '\\';

Index: php-src/ext/pcre/tests/bug26927.phpt
+++ php-src/ext/pcre/tests/bug26927.phpt
--TEST--
Bug #26927 (preg_quote() does not escape \0) 
--FILE--
<?php
        $str = "a\000b";
        $str_quoted = preg_quote($str);
        var_dump(preg_match("!{$str_quoted}!", $str), $str_quoted);
?>
--EXPECT--
int(1)
string(4) "a\0b"

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to