Re: cvs: php4 /ext/iconv iconv.c

From: Date: Sun, 10 Mar 2002 09:33:35 +0000
Subject: Re: cvs: php4 /ext/iconv iconv.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9862@lists.php.net to get a copy of this message
Hello, is this a candidate to Merge to the branch? Derick On Sun, 10 Mar 2002, Markus Fischer wrote: > mfischer Sun Mar 10 04:22:31 2002 EDT > > Modified files: > /php4/ext/iconv iconv.c > Log: > - Fix crash in iconv_set_encoding(). [Closes #15799] > > > > Index: php4/ext/iconv/iconv.c > diff -u php4/ext/iconv/iconv.c:1.31 php4/ext/iconv/iconv.c:1.32 > --- php4/ext/iconv/iconv.c:1.31 Wed Mar 6 06:20:11 2002 > +++ php4/ext/iconv/iconv.c Sun Mar 10 04:22:31 2002 > @@ -17,7 +17,7 @@ > +----------------------------------------------------------------------+ > */ > > -/* $Id: iconv.c,v 1.31 2002/03/06 11:20:11 derick Exp $ */ > +/* $Id: iconv.c,v 1.32 2002/03/10 09:22:31 mfischer Exp $ */ > > #ifdef HAVE_CONFIG_H > #include "config.h" > @@ -331,7 +331,7 @@ > PHP_FUNCTION(iconv_set_encoding) > { > zval **type, **charset; > - int argc = ZEND_NUM_ARGS(); > + int argc = ZEND_NUM_ARGS(), retval; > > if (argc != 2 || zend_get_parameters_ex(2, &type, &charset) == FAILURE) { > WRONG_PARAM_COUNT; > @@ -341,25 +341,20 @@ > convert_to_string_ex(charset); > > if(!strcasecmp("input_encoding", Z_STRVAL_PP(type))) { > - if (ICONVG(input_encoding)) { > - free(ICONVG(input_encoding)); > - } > - ICONVG(input_encoding) = estrndup(Z_STRVAL_PP(charset), Z_STRLEN_PP(charset)); > + retval = zend_alter_ini_entry("iconv.input_encoding", > sizeof("iconv.input_encoding"), Z_STRVAL_PP(charset), Z_STRLEN_PP(charset), PHP_INI_USER, > PHP_INI_STAGE_RUNTIME); > } else if(!strcasecmp("output_encoding", Z_STRVAL_PP(type))) { > - if (ICONVG(output_encoding)) { > - free(ICONVG(output_encoding)); > - } > - ICONVG(output_encoding) = estrndup(Z_STRVAL_PP(charset), Z_STRLEN_PP(charset)); > + retval = zend_alter_ini_entry("iconv.output_encoding", > sizeof("iconv.output_encoding"), Z_STRVAL_PP(charset), Z_STRLEN_PP(charset), PHP_INI_USER, > PHP_INI_STAGE_RUNTIME); > } else if(!strcasecmp("internal_encoding", Z_STRVAL_PP(type))) { > - if (ICONVG(internal_encoding)) { > - free(ICONVG(internal_encoding)); > - } > - ICONVG(internal_encoding) = estrndup(Z_STRVAL_PP(charset), Z_STRLEN_PP(charset)); > + retval = zend_alter_ini_entry("iconv.internal_encoding", > sizeof("iconv.internal_encoding"), Z_STRVAL_PP(charset), Z_STRLEN_PP(charset), > PHP_INI_USER, PHP_INI_STAGE_RUNTIME); > } else { > RETURN_FALSE; > } > > - RETURN_TRUE; > + if (retval == SUCCESS) { > + RETURN_TRUE; > + } else { > + RETURN_FALSE; > + } > } > /* }}} */ > > > > > -- > PHP CVS Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > ---------------------------------------------------------------------- PHP: Scripting the Web - derick@php.net All your branches are belong to me! SRM: Site Resource Manager - www.vl-srm.net -----------------------------------------------------------------------

« previous php.cvs (#9862) next »