sniper Tue May 31 08:54:57 2005 EDT Added files: /php-src/ext/pcre/tests bug33200.phpt
Modified files: /php-src/ext/pcre php_pcre.c /php-src/ext/standard php_string.h string.c Log: - Fixed bug #33200 (preg_replace(): magic_quotes_sybase=On makes 'e' modifier misbehave) http://cvs.php.net/diff.php/php-src/ext/pcre/php_pcre.c?r1=1.166&r2=1.167&ty=u Index: php-src/ext/pcre/php_pcre.c diff -u php-src/ext/pcre/php_pcre.c:1.166 php-src/ext/pcre/php_pcre.c:1.167 --- php-src/ext/pcre/php_pcre.c:1.166 Tue May 24 17:07:32 2005 +++ php-src/ext/pcre/php_pcre.c Tue May 31 08:54:55 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.166 2005/05/24 21:07:32 andrei Exp $ */ +/* $Id: php_pcre.c,v 1.167 2005/05/31 12:54:55 sniper Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -761,9 +761,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.85&r2=1.86&ty=u Index: php-src/ext/standard/php_string.h diff -u php-src/ext/standard/php_string.h:1.85 php-src/ext/standard/php_string.h:1.86 --- php-src/ext/standard/php_string.h:1.85 Wed Nov 3 18:36:50 2004 +++ php-src/ext/standard/php_string.h Tue May 31 08:54:56 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_string.h,v 1.85 2004/11/03 23:36:50 derick Exp $ */ +/* $Id: php_string.h,v 1.86 2005/05/31 12:54:56 sniper Exp $ */ /* Synced with php 3.0 revision 1.43 1999-06-16 [ssb] */ @@ -119,6 +119,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.436&r2=1.437&ty=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.436 php-src/ext/standard/string.c:1.437 --- php-src/ext/standard/string.c:1.436 Fri May 20 10:23:41 2005 +++ php-src/ext/standard/string.c Tue May 31 08:54:56 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.436 2005/05/20 14:23:41 tony2001 Exp $ */ +/* $Id: string.c,v 1.437 2005/05/31 12:54:56 sniper Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -2910,6 +2910,14 @@ */ 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); +} +/* }}} */ + +/* {{{ php_addslashes_ex + */ +PHPAPI char *php_addslashes_ex(char *str, int length, int *new_length, int should_free, int ignore_sybase TSRMLS_DC) +{ /* maximum string length, worst case situation */ char *new_str; char *source, *target; @@ -2928,7 +2936,7 @@ end = source + length; target = new_str; - if (PG(magic_quotes_sybase)) { + if (!ignore_sybase && PG(magic_quotes_sybase)) { while (source < end) { switch (*source) { case '\0': 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