cvs: php4 /ext/standard string.c

From: Date: Sun, 17 Sep 2000 09:15:48 +0000
Subject: cvs: php4 /ext/standard string.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1769@lists.php.net to get a copy of this message
stas Sun Sep 17 02:15:48 2000 EDT Modified files: /php4/ext/standard string.c Log: Add empty string checks to add?slashes Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.157 php4/ext/standard/string.c:1.158 --- php4/ext/standard/string.c:1.157 Tue Sep 12 12:00:21 2000 +++ php4/ext/standard/string.c Sun Sep 17 02:15:48 2000 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.157 2000/09/12 19:00:21 danbeck Exp $ */ +/* $Id: string.c,v 1.158 2000/09/17 09:15:48 stas Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -1737,6 +1737,15 @@ } convert_to_string_ex(str); convert_to_string_ex(what); + + if(Z_STRLEN_PP(str) == 0) { + RETURN_EMPTY_STRING(); + } + + if(Z_STRLEN_PP(what) == 0) { + RETURN_STRINGL(Z_STRVAL_PP(str),Z_STRLEN_PP(str),1); + } + return_value->value.str.val = php_addcslashes((*str)->value.str.val,(*str)->value.str.len,&return_value->value.str.len,0,(*what)->value.str.val,(*what)->value.str.len); return_value->type = IS_STRING; } @@ -1752,6 +1761,11 @@ WRONG_PARAM_COUNT; } convert_to_string_ex(str); + + if(Z_STRLEN_PP(str) == 0) { + RETURN_EMPTY_STRING(); + } + return_value->value.str.val = php_addslashes((*str)->value.str.val,(*str)->value.str.len,&return_value->value.str.len,0); return_value->type = IS_STRING; }

« previous php.cvs (#1769) next »