--- embedaddon/php/ext/enchant/enchant.c 2012/02/21 23:47:54 1.1.1.1 +++ embedaddon/php/ext/enchant/enchant.c 2013/10/14 08:02:11 1.1.1.4 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 The PHP Group | + | Copyright (c) 1997-2013 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.0 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -16,17 +16,17 @@ | Ilia Alshanetsky | +----------------------------------------------------------------------+ - $Id: enchant.c,v 1.1.1.1 2012/02/21 23:47:54 misho Exp $ + $Id: enchant.c,v 1.1.1.4 2013/10/14 08:02:11 misho Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" #endif -#include #include "php.h" #include "php_ini.h" #include "ext/standard/info.h" +#include #include "php_enchant.h" typedef EnchantBroker * EnchantBrokerPtr; @@ -124,7 +124,7 @@ ZEND_END_ARG_INFO() * * Every user visible function must have an entry in enchant_functions[]. */ -function_entry enchant_functions[] = { +zend_function_entry enchant_functions[] = { PHP_FE(enchant_broker_init, arginfo_enchant_broker_init) PHP_FE(enchant_broker_free, arginfo_enchant_broker_free) PHP_FE(enchant_broker_get_error, arginfo_enchant_broker_free) @@ -244,8 +244,8 @@ static void php_enchant_broker_free(zend_rsrc_list_ent if (broker->pbroker) { if (broker->dictcnt && broker->dict) { if (broker->dict) { - int total, tofree; - tofree = total = broker->dictcnt-1; + int total; + total = broker->dictcnt-1; do { zend_list_delete(broker->dict[total]->rsrc_id); efree(broker->dict[total]); @@ -326,7 +326,7 @@ PHP_MINFO_FUNCTION(enchant) #elif defined(HAVE_ENCHANT_BROKER_SET_PARAM) php_info_print_table_row(2, "Libenchant Version", "1.5.0 or later"); #endif - php_info_print_table_row(2, "Revision", "$Revision: 1.1.1.1 $"); + php_info_print_table_row(2, "Revision", "$Id: enchant.c,v 1.1.1.4 2013/10/14 08:02:11 misho Exp $"); php_info_print_table_end(); php_info_print_table_start(); @@ -357,8 +357,8 @@ PHP_FUNCTION(enchant_broker_init) enchant_broker *broker; EnchantBroker *pbroker; - if (ZEND_NUM_ARGS()) { - ZEND_WRONG_PARAM_COUNT(); + if (zend_parse_parameters_none() == FAILURE) { + return; } pbroker = enchant_broker_init(); @@ -542,6 +542,11 @@ PHP_FUNCTION(enchant_broker_request_dict) } PHP_ENCHANT_GET_BROKER; + + if (taglen == 0) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tag cannot be empty"); + RETURN_FALSE; + } d = enchant_broker_request_dict(pbroker->pbroker, (const char *)tag); if (d) { @@ -586,14 +591,10 @@ PHP_FUNCTION(enchant_broker_request_pwl_dict) int pwllen; int pos; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs", &broker, &pwl, &pwllen) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rp", &broker, &pwl, &pwllen) == FAILURE) { RETURN_FALSE; } - if (strlen(pwl) != pwllen) { - RETURN_FALSE; - } - #if PHP_API_VERSION < 20100412 if ((PG(safe_mode) && (!php_checkuid(pwl, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(pwl TSRMLS_CC)) { #else @@ -650,7 +651,7 @@ PHP_FUNCTION(enchant_broker_free_dict) /* }}} */ /* {{{ proto bool enchant_broker_dict_exists(resource broker, string tag) - Wether a dictionary exists or not. Using non-empty tag */ + Whether a dictionary exists or not. Using non-empty tag */ PHP_FUNCTION(enchant_broker_dict_exists) { zval *broker; @@ -673,7 +674,7 @@ PHP_FUNCTION(enchant_broker_dict_exists) described/referred to by 'tag'. The ordering is a comma delimited list of provider names. As a special exception, the "*" tag can be used as a language tag to declare a default ordering for any - language that does not explictly declare an ordering. */ + language that does not explicitly declare an ordering. */ PHP_FUNCTION(enchant_broker_set_ordering) { @@ -729,6 +730,7 @@ PHP_FUNCTION(enchant_dict_quick_check) if (sugg) { zval_dtor(sugg); + array_init(sugg); } PHP_ENCHANT_GET_DICT; @@ -741,8 +743,6 @@ PHP_FUNCTION(enchant_dict_quick_check) if (!sugg && ZEND_NUM_ARGS() == 2) { RETURN_FALSE; } - - array_init(sugg); suggs = enchant_dict_suggest(pdict->pdict, word, wordlen, &n_sugg_st); memcpy(&n_sugg, &n_sugg_st, sizeof(n_sugg));