diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2004-06-01 18:59:49 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2004-06-01 18:59:49 +0000 |
commit | db9f1fafa5640e0166e17e99ec27d4b9e15af286 (patch) | |
tree | f3e21e66e99d302ce8d8ed57deaffcddb5478372 /ext/enchant/enchant.c | |
parent | b027552ca3b72bf484e46c6a6c55cc578ff02421 (diff) | |
download | php-git-db9f1fafa5640e0166e17e99ec27d4b9e15af286.tar.gz |
Fixed leak inside MINFO function.
Fixed crash inside enchant_dict_suggest() when there are no suggestions.
Added missing safe_mode/open_basedir check inside
enchant_broker_request_pwl_dict().
Fixed various function prototypes.
Diffstat (limited to 'ext/enchant/enchant.c')
-rwxr-xr-x | ext/enchant/enchant.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/ext/enchant/enchant.c b/ext/enchant/enchant.c index 1946e50fbc..b92fa9d468 100755 --- a/ext/enchant/enchant.c +++ b/ext/enchant/enchant.c @@ -237,6 +237,7 @@ PHP_MINFO_FUNCTION(enchant) php_info_print_table_start(); enchant_broker_describe(pbroker, __enumerate_providers_fn, NULL); php_info_print_table_end(); + enchant_broker_free(pbroker); } /* }}} */ @@ -369,7 +370,7 @@ PHP_FUNCTION(enchant_broker_request_dict) } /* }}} */ -/* {{{ proto resource enchant_broker_request_pwl_dict(resource dict, string tag) +/* {{{ proto resource enchant_broker_request_pwl_dict(resource dict, string filename) creates a dictionary using a PWL file. A PWL file is personal word file one word per line. It must exist before the call.*/ PHP_FUNCTION(enchant_broker_request_pwl_dict) @@ -386,6 +387,10 @@ PHP_FUNCTION(enchant_broker_request_pwl_dict) RETURN_FALSE; } + if ((PG(safe_mode) && (!php_checkuid(pwl, NULL, CHECKUID_CHECK_FILE_AND_DIR))) || php_check_open_basedir(pwl TSRMLS_CC)) { + RETURN_FALSE; + } + PHP_ENCHANT_GET_BROKER; d = enchant_broker_request_pwl_dict(pbroker->pbroker, (const char *)pwl); @@ -500,6 +505,9 @@ PHP_FUNCTION(enchant_broker_describe) } /* }}} */ +/* {{{ proto bool enchant_dict_quick_check(resource dict, string word [, array &suggestions]) + If the word is correctly spelled return true, otherwise return false, if suggestions variable + is provided, fill it with spelling alternatives. */ PHP_FUNCTION(enchant_dict_quick_check) { zval *dict, *sugg = NULL; @@ -541,8 +549,9 @@ PHP_FUNCTION(enchant_dict_quick_check) } RETURN_TRUE; } +/* }}} */ -/* {{{ proto long enchant_dict_check(resource broker) +/* {{{ proto bool enchant_dict_check(resource dict, string word) If the word is correctly spelled return true, otherwise return false */ PHP_FUNCTION(enchant_dict_check) { @@ -561,7 +570,7 @@ PHP_FUNCTION(enchant_dict_check) } /* }}} */ -/* {{{ proto array enchant_dict_suggest(resource broker, string word) +/* {{{ proto array enchant_dict_suggest(resource dict, string word) Will return a list of values if any of those pre-conditions are not met.*/ PHP_FUNCTION(enchant_dict_suggest) { @@ -586,13 +595,14 @@ PHP_FUNCTION(enchant_dict_suggest) for (i = 0; i < n_sugg; i++) { add_next_index_string(return_value, suggs[i], 1); } + + enchant_dict_free_suggestions(pdict->pdict, suggs); } - enchant_dict_free_suggestions(pdict->pdict, suggs); } /* }}} */ -/* {{{ proto void enchant_dict_add_to_personal(resource broker) - A list of UTF-8 encoded suggestions, or false */ +/* {{{ proto void enchant_dict_add_to_personal(resource dict, string word) + add 'word' to personal word list */ PHP_FUNCTION(enchant_dict_add_to_personal) { zval *dict; @@ -610,7 +620,7 @@ PHP_FUNCTION(enchant_dict_add_to_personal) } /* }}} */ -/* {{{ proto void enchant_dict_add_to_session(resource broker, string word) +/* {{{ proto void enchant_dict_add_to_session(resource dict, string word) add 'word' to this spell-checking session */ PHP_FUNCTION(enchant_dict_add_to_session) { @@ -629,7 +639,7 @@ PHP_FUNCTION(enchant_dict_add_to_session) } /* }}} */ -/* {{{ proto bool enchant_dict_is_in_session(resource broker) +/* {{{ proto bool enchant_dict_is_in_session(resource dict, string word) whether or not 'word' exists in this spelling-session */ PHP_FUNCTION(enchant_dict_is_in_session) { @@ -648,7 +658,7 @@ PHP_FUNCTION(enchant_dict_is_in_session) } /* }}} */ -/* {{{ proto void enchant_dict_store_replacement(resource broker, string mis, string cor) +/* {{{ proto void enchant_dict_store_replacement(resource dict, string mis, string cor) add a correction for 'mis' using 'cor'. Notes that you replaced @mis with @cor, so it's possibly more likely that future occurrences of @mis will be replaced with @cor. So it might |