sniper          Tue May 31 08:56:02 2005 EDT

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

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/pcre   php_pcre.c 
    /php-src/ext/standard       php_string.h string.c 
  Log:
  MFH: - Fixed bug #33200 (preg_replace(): magic_quotes_sybase=On makes 'e' 
modifier misbehave)
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.914&r2=1.1247.2.915&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.914 php-src/NEWS:1.1247.2.915
--- php-src/NEWS:1.1247.2.914   Mon May 23 17:50:58 2005
+++ php-src/NEWS        Tue May 31 08:56:00 2005
@@ -7,6 +7,8 @@
   them sort based on the current locale. (Derick)
 - Changed sha1_file() and md5_file() functions to use streams instead of 
   low level IO. (Uwe)
+- Fixed bug #33200 (preg_replace(): magic_quotes_sybase=On makes 'e' modifier
+  misbehave). (Jani)
 - Fixed bug #33072 (Add a safemode/open_basedir check for runtime save_path 
   change) (Rasmus)
 - Fixed bug #33057 (Don't send extraneous entity-headers on a 304 as per
http://cvs.php.net/diff.php/php-src/ext/pcre/php_pcre.c?r1=1.132.2.23&r2=1.132.2.24&ty=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.132.2.23 
php-src/ext/pcre/php_pcre.c:1.132.2.24
--- php-src/ext/pcre/php_pcre.c:1.132.2.23      Tue May 24 17:12:16 2005
+++ php-src/ext/pcre/php_pcre.c Tue May 31 08:56:00 2005
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: php_pcre.c,v 1.132.2.23 2005/05/24 21:12:16 andrei Exp $ */
+/* $Id: php_pcre.c,v 1.132.2.24 2005/05/31 12:56:00 sniper Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -750,9 +750,9 @@
                                           in instead of the backref */
                                        match = subject + offsets[backref<<1];
                                        match_len = offsets[(backref<<1)+1] - 
offsets[backref<<1];
-                                       if (match_len)
-                                               esc_match = 
php_addslashes(match, match_len, &esc_match_len, 0 TSRMLS_CC);
-                                       else {
+                                       if (match_len) {
+                                               esc_match = 
php_addslashes_ex(match, match_len, &esc_match_len, 0, 1 TSRMLS_CC);
+                                       } else {
                                                esc_match = match;
                                                esc_match_len = 0;
                                        }
http://cvs.php.net/diff.php/php-src/ext/standard/php_string.h?r1=1.65.2.4&r2=1.65.2.5&ty=u
Index: php-src/ext/standard/php_string.h
diff -u php-src/ext/standard/php_string.h:1.65.2.4 
php-src/ext/standard/php_string.h:1.65.2.5
--- php-src/ext/standard/php_string.h:1.65.2.4  Wed Nov  3 18:36:01 2004
+++ php-src/ext/standard/php_string.h   Tue May 31 08:56:00 2005
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: php_string.h,v 1.65.2.4 2004/11/03 23:36:01 derick Exp $ */
+/* $Id: php_string.h,v 1.65.2.5 2005/05/31 12:56:00 sniper Exp $ */
 
 /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */
 
@@ -116,6 +116,7 @@
 PHPAPI char *php_strtolower(char *s, size_t len);
 PHPAPI char *php_strtr(char *str, int len, char *str_from, char *str_to, int 
trlen);
 PHPAPI char *php_addslashes(char *str, int length, int *new_length, int freeit 
TSRMLS_DC);
+PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int 
freeit, int ignore_sybase TSRMLS_DC);
 PHPAPI char *php_addcslashes(char *str, int length, int *new_length, int 
freeit, char *what, int wlength TSRMLS_DC);
 PHPAPI void php_stripslashes(char *str, int *len TSRMLS_DC);
 PHPAPI void php_stripcslashes(char *str, int *len);
http://cvs.php.net/diff.php/php-src/ext/standard/string.c?r1=1.333.2.49&r2=1.333.2.50&ty=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.333.2.49 
php-src/ext/standard/string.c:1.333.2.50
--- php-src/ext/standard/string.c:1.333.2.49    Sun Apr  3 14:09:54 2005
+++ php-src/ext/standard/string.c       Tue May 31 08:56:00 2005
@@ -18,7 +18,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: string.c,v 1.333.2.49 2005/04/03 18:09:54 iliaa Exp $ */
+/* $Id: string.c,v 1.333.2.50 2005/05/31 12:56:00 sniper Exp $ */
 
 /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
 
@@ -2413,18 +2413,26 @@
 }
 /* }}} */
 
+/* {{{ php_addslashes
+ */
+PHPAPI char *php_addslashes(char *str, int length, int *new_length, int 
should_free TSRMLS_DC)
+{
+       return php_addslashes_ex(str, length, new_length, should_free, 0 
TSRMLS_CC);
+}
+/* }}} */
+
 /* true static */
 const unsigned char php_esc_list[256] = 
{2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
 
-/* {{{ php_addslashes
+/* {{{ php_addslashes_ex
  */
-PHPAPI char *php_addslashes(char *str, int length, int *new_length, int 
should_free TSRMLS_DC)
+PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int 
should_free, int ignore_sybase TSRMLS_DC)
 {
        char *e = str + (length ? length : (length = strlen(str)));
        char *p = str;
        char *new_str, *ps;
        int local_new_length = length;
-       int type = PG(magic_quotes_sybase) ? 1 : 0;
+       int type = (!ignore_sybase && PG(magic_quotes_sybase)) ? 1 : 0;
 
        if (!new_length) {
                new_length = &local_new_length;

http://cvs.php.net/co.php/php-src/ext/pcre/tests/bug33200.phpt?r=1.1&p=1
Index: php-src/ext/pcre/tests/bug33200.phpt
+++ php-src/ext/pcre/tests/bug33200.phpt
--TEST--
Bug #33200 (magic_quotes_sybase = On makes 'e' modifier misbehave)
--INI--
magic_quotes_sybase=1
--FILE--
<?php
$str = 'some \'$sample\' text';
$str = preg_replace("/(some.*text)/e", "strtoupper('\\1')", $str);
echo $str;
?>
--EXPECT--
SOME '$SAMPLE' TEXT

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

Reply via email to