cvs: php-src(PHP_5_0) / NEWS /ext/pcre php_pcre.c /ext/pcre/tests bug33200.phpt /ext/standard php_string.h string.c

From: Date: Tue, 31 May 2005 12:55:34 +0000
Subject: cvs: php-src(PHP_5_0) / NEWS /ext/pcre php_pcre.c /ext/pcre/tests bug33200.phpt /ext/standard php_string.h string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-32048@lists.php.net to get a copy of this message
sniper Tue May 31 08:55:34 2005 EDT Added files: (Branch: PHP_5_0) /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.1760.2.407&r2=1.1760.2.408&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1760.2.407 php-src/NEWS:1.1760.2.408 --- php-src/NEWS:1.1760.2.407 Mon May 30 19:46:27 2005 +++ php-src/NEWS Tue May 31 08:55:32 2005 @@ -12,6 +12,8 @@ - Fixed ext/mysqli to allocate less memory when fetching bound params of type (MEDIUM|LONG)BLOB/(MEDIUM|LONG)TEXT. (Andrey) - Fixed memory corruption in ImageTTFText() with 64bit systems. (Andrey) +- Fixed bug #33200 (preg_replace(): magic_quotes_sybase=On makes 'e' modifier + misbehave). (Jani) - Fixed bug #33185 (--enable-session=shared does not build). (Jani) - Fixed bug #33164 (Soap extension incorrectly detects HTTP/1.1). (Ilia) - Fixed bug #33116 (crash when assigning class name to global variable in http://cvs.php.net/diff.php/php-src/ext/pcre/php_pcre.c?r1=1.157.2.4&r2=1.157.2.5&ty=u Index: php-src/ext/pcre/php_pcre.c diff -u php-src/ext/pcre/php_pcre.c:1.157.2.4 php-src/ext/pcre/php_pcre.c:1.157.2.5 --- php-src/ext/pcre/php_pcre.c:1.157.2.4 Tue May 24 18:11:39 2005 +++ php-src/ext/pcre/php_pcre.c Tue May 31 08:55:33 2005 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_pcre.c,v 1.157.2.4 2005/05/24 22:11:39 andrei Exp $ */ +/* $Id: php_pcre.c,v 1.157.2.5 2005/05/31 12:55:33 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.84.2.1&r2=1.84.2.2&ty=u Index: php-src/ext/standard/php_string.h diff -u php-src/ext/standard/php_string.h:1.84.2.1 php-src/ext/standard/php_string.h:1.84.2.2 --- php-src/ext/standard/php_string.h:1.84.2.1 Wed Nov 3 18:27:26 2004 +++ php-src/ext/standard/php_string.h Tue May 31 08:55:33 2005 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: php_string.h,v 1.84.2.1 2004/11/03 23:27:26 derick Exp $ */ +/* $Id: php_string.h,v 1.84.2.2 2005/05/31 12:55:33 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.420.2.8&r2=1.420.2.9&ty=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.420.2.8 php-src/ext/standard/string.c:1.420.2.9 --- php-src/ext/standard/string.c:1.420.2.8 Fri May 20 10:24:16 2005 +++ php-src/ext/standard/string.c Tue May 31 08:55:33 2005 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.420.2.8 2005/05/20 14:24:16 tony2001 Exp $ */ +/* $Id: string.c,v 1.420.2.9 2005/05/31 12:55:33 sniper Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -2862,6 +2862,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; @@ -2880,7 +2888,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

« previous php.cvs (#32048) next »