cvs: php4(PHP_4_2_0) /ext/iconv iconv.c

From: Date: Sun, 10 Mar 2002 23:00:36 +0000
Subject: cvs: php4(PHP_4_2_0) /ext/iconv iconv.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-9878@lists.php.net to get a copy of this message
mfischer Sun Mar 10 18:00:36 2002 EDT Modified files: (Branch: PHP_4_2_0) /php4/ext/iconv iconv.c Log: - MFH fix for #15799. Index: php4/ext/iconv/iconv.c diff -u php4/ext/iconv/iconv.c:1.31 php4/ext/iconv/iconv.c:1.31.2.1 --- php4/ext/iconv/iconv.c:1.31 Wed Mar 6 06:20:11 2002 +++ php4/ext/iconv/iconv.c Sun Mar 10 18:00:35 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: iconv.c,v 1.31 2002/03/06 11:20:11 derick Exp $ */ +/* $Id: iconv.c,v 1.31.2.1 2002/03/10 23:00:35 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; + } } /* }}} */

« previous php.cvs (#9878) next »