cvs: /php4/ext/standard string.c /php4/ext/wddx wddx.c

From: Date: Wed, 02 Feb 2000 21:53:57 +0000
Subject: cvs: /php4/ext/standard string.c /php4/ext/wddx wddx.c
Groups: php.version4 
Request: Send a blank email to php-version4+get-9698@lists.php.net to get a copy of this message
andrei Wed Feb 2 22:53:57 2000 EDT Modified files: /php4/ext/standard string.c /php4/ext/wddx wddx.c Log: (PHP wddx_deserialize) Fixed a problem with deserializing empty values. (php_addslashes) Guard against NULL data. Index: php4/ext/standard/string.c diff -u php4/ext/standard/string.c:1.89 php4/ext/standard/string.c:1.90 --- php4/ext/standard/string.c:1.89 Sat Jan 29 18:54:30 2000 +++ php4/ext/standard/string.c Wed Feb 2 22:53:27 2000 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.89 2000/01/29 17:54:30 zeev Exp $ */ +/* $Id: string.c,v 1.90 2000/02/02 21:53:27 andrei Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -1636,12 +1636,17 @@ PHPAPI char *php_addslashes(char *str, int length, int *new_length, int should_free) { /* maximum string length, worst case situation */ - char *new_str = (char *) emalloc((length?length:(length=strlen(str)))*2+1); + char *new_str; char *source,*target; char *end; char c; PLS_FETCH(); - + + if (!str) { + *new_length = 0; + return str; + } + new_str = (char *) emalloc((length?length:(length=strlen(str)))*2+1); for (source=str,end=source+length,target=new_str; (c = *source) || source<end; source++) { switch(c) { case '\0': Index: php4/ext/wddx/wddx.c diff -u php4/ext/wddx/wddx.c:1.22 php4/ext/wddx/wddx.c:1.23 --- php4/ext/wddx/wddx.c:1.22 Sun Jan 16 00:34:51 2000 +++ php4/ext/wddx/wddx.c Wed Feb 2 22:53:27 2000 @@ -27,7 +27,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: wddx.c,v 1.22 2000/01/15 23:34:51 andrei Exp $ */ +/* $Id: wddx.c,v 1.23 2000/02/02 21:53:27 andrei Exp $ */ #include "php.h" #include "php_wddx.h" @@ -509,9 +509,10 @@ SET_STACK_VARNAME; ALLOC_ZVAL(ent.data); - ent.data->value.str.val = NULL; - ent.data->value.str.len = 0; INIT_PZVAL(ent.data); + ent.data->type = IS_STRING; + ent.data->value.str.val = empty_string; + ent.data->value.str.len = 0; wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp(name, EL_CHAR)) { int i; @@ -529,6 +530,7 @@ ALLOC_ZVAL(ent.data); INIT_PZVAL(ent.data); + ent.data->type = IS_LONG; wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); } else if (!strcmp(name, EL_BOOLEAN)) { int i; @@ -540,6 +542,7 @@ ALLOC_ZVAL(ent.data); INIT_PZVAL(ent.data); + ent.data->type = IS_BOOL; wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry)); php_wddx_process_data(user_data, atts[i+1], strlen(atts[i+1])); } @@ -667,7 +670,6 @@ wddx_stack_top(stack, (void**)&ent); switch (ent->type) { case ST_STRING: - ent->data->type = IS_STRING; if (ent->data->value.str.len == 0) { ent->data->value.str.val = estrndup(s, len); ent->data->value.str.len = len; @@ -688,7 +690,6 @@ break; case ST_BOOLEAN: - ent->data->type = IS_BOOL; if (!strcmp(s, "true")) ent->data->value.lval = 1; else if (!strcmp(s, "false"))

« previous php.version4 (#9698) next »