cvs: php4(PHP_4_2_0) /ext/iconv iconv.c
| From: | Jani Taskinen | Date: | Wed, 11 Sep 2002 15:29:51 +0000 |
| Subject: | cvs: php4(PHP_4_2_0) /ext/iconv iconv.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-14020@lists.php.net to get a copy of this message | ||
sniper Wed Sep 11 11:29:51 2002 EDT
Modified files: (Branch: PHP_4_2_0)
/php4/ext/iconv iconv.c
Log:
Fix bug: #19355 (the parameter is optional)
Index: php4/ext/iconv/iconv.c
diff -u php4/ext/iconv/iconv.c:1.31.2.2 php4/ext/iconv/iconv.c:1.31.2.3
--- php4/ext/iconv/iconv.c:1.31.2.2 Thu Mar 21 15:25:25 2002
+++ php4/ext/iconv/iconv.c Wed Sep 11 11:29:50 2002
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: iconv.c,v 1.31.2.2 2002/03/21 20:25:25 sniper Exp $ */
+/* $Id: iconv.c,v 1.31.2.3 2002/09/11 15:29:50 sniper Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -367,35 +367,28 @@
Get internal encoding and output encoding for ob_iconv_handler() */
PHP_FUNCTION(iconv_get_encoding)
{
- zval **type;
- int argc = ZEND_NUM_ARGS();
-
- if (argc < 0 || argc > 1 || zend_get_parameters_ex(1, &type) == FAILURE) {
- WRONG_PARAM_COUNT;
- }
-
- convert_to_string_ex(type);
-
- if (argc == 0 || !strcasecmp("all", Z_STRVAL_PP(type))) {
+ char *type = "all";
+ int type_len;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &type, &type_len) ==
FAILURE)
+ return;
+
+ if (!strcasecmp("all", type)) {
if (array_init(return_value) == FAILURE) {
RETURN_FALSE;
}
- add_assoc_string(return_value, "input_encoding",
- ICONVG(input_encoding), 1);
- add_assoc_string(return_value, "output_encoding",
- ICONVG(output_encoding), 1);
- add_assoc_string(return_value, "internal_encoding",
- ICONVG(internal_encoding), 1);
- } else if (!strcasecmp("input_encoding", Z_STRVAL_PP(type))) {
+ add_assoc_string(return_value, "input_encoding", ICONVG(input_encoding), 1);
+ add_assoc_string(return_value, "output_encoding", ICONVG(output_encoding), 1);
+ add_assoc_string(return_value, "internal_encoding", ICONVG(internal_encoding), 1);
+ } else if (!strcasecmp("input_encoding", type)) {
RETVAL_STRING(ICONVG(input_encoding), 1);
- } else if (!strcasecmp("output_encoding", Z_STRVAL_PP(type))) {
+ } else if (!strcasecmp("output_encoding", type)) {
RETVAL_STRING(ICONVG(output_encoding), 1);
- } else if (!strcasecmp("internal_encoding", Z_STRVAL_PP(type))) {
+ } else if (!strcasecmp("internal_encoding", type)) {
RETVAL_STRING(ICONVG(internal_encoding), 1);
} else {
RETURN_FALSE;
}
-
}
/* }}} */