summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-01-16 11:19:10 +0000
committerAntony Dovgal <tony2001@php.net>2007-01-16 11:19:10 +0000
commitbd6c862feee99e660686e037cd1a7fcbb3d9ca0e (patch)
treef6bc31006b3590f1ad0791f59aa3206f83adcefe
parent7ad1c3c5f2fac4f22c2e7adc5b0b9d9a83f9a17e (diff)
downloadphp-git-bd6c862feee99e660686e037cd1a7fcbb3d9ca0e.tar.gz
MFH
-rw-r--r--ext/pspell/pspell.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
index 75b2aaac6e..478d6ad9e5 100644
--- a/ext/pspell/pspell.c
+++ b/ext/pspell/pspell.c
@@ -186,6 +186,7 @@ static PHP_FUNCTION(pspell_new)
* pointing to the location of the dictionaries
*/
if(0 == RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Aspell", &hkey)) {
+ dwLen = sizeof(aspell_dir) - 1;
RegQueryValueEx(hkey, "", NULL, &dwType, (LPBYTE)&aspell_dir, &dwLen);
RegCloseKey(hkey);
strcpy(data_dir, aspell_dir);
@@ -247,6 +248,7 @@ static PHP_FUNCTION(pspell_new)
if(pspell_error_number(ret) != 0){
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PSPELL couldn't open the dictionary. reason: %s ", pspell_error_message(ret));
+ delete_pspell_manager(ret);
RETURN_FALSE;
}
@@ -289,6 +291,7 @@ static PHP_FUNCTION(pspell_new_personal)
* pointing to the location of the dictionaries
*/
if(0 == RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Aspell", &hkey)) {
+ dwLen = sizeof(aspell_dir) - 1;
RegQueryValueEx(hkey, "", NULL, &dwType, (LPBYTE)&aspell_dir, &dwLen);
RegCloseKey(hkey);
strcpy(data_dir, aspell_dir);
@@ -304,10 +307,12 @@ static PHP_FUNCTION(pspell_new_personal)
convert_to_string_ex(personal);
if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(personal), NULL, CHECKUID_CHECK_FILE_AND_DIR))) {
+ delete_pspell_config(config);
RETURN_FALSE;
}
if (php_check_open_basedir(Z_STRVAL_PP(personal) TSRMLS_CC)) {
+ delete_pspell_config(config);
RETURN_FALSE;
}
@@ -363,6 +368,7 @@ static PHP_FUNCTION(pspell_new_personal)
if(pspell_error_number(ret) != 0){
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PSPELL couldn't open the dictionary. reason: %s ", pspell_error_message(ret));
+ delete_pspell_manager(ret);
RETURN_FALSE;
}
@@ -396,6 +402,7 @@ static PHP_FUNCTION(pspell_new_config)
if(pspell_error_number(ret) != 0){
php_error_docref(NULL TSRMLS_CC, E_WARNING, "PSPELL couldn't open the dictionary. reason: %s ", pspell_error_message(ret));
+ delete_pspell_manager(ret);
RETURN_FALSE;
}
@@ -641,17 +648,18 @@ static PHP_FUNCTION(pspell_config_create)
/* If aspell was installed using installer, we should have a key
* pointing to the location of the dictionaries
*/
- if(0 == RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Aspell", &hkey)) {
- RegQueryValueEx(hkey, "", NULL, &dwType, (LPBYTE)&aspell_dir, &dwLen);
- RegCloseKey(hkey);
- strcpy(data_dir, aspell_dir);
- strcat(data_dir, "\\data");
- strcpy(dict_dir, aspell_dir);
- strcat(dict_dir, "\\dict");
-
- pspell_config_replace(config, "data-dir", data_dir);
- pspell_config_replace(config, "dict-dir", dict_dir);
- }
+ if(0 == RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Aspell", &hkey)) {
+ dwLen = sizeof(aspell_dir) - 1;
+ RegQueryValueEx(hkey, "", NULL, &dwType, (LPBYTE)&aspell_dir, &dwLen);
+ RegCloseKey(hkey);
+ strcpy(data_dir, aspell_dir);
+ strcat(data_dir, "\\data");
+ strcpy(dict_dir, aspell_dir);
+ strcat(dict_dir, "\\dict");
+
+ pspell_config_replace(config, "data-dir", data_dir);
+ pspell_config_replace(config, "dict-dir", dict_dir);
+ }
#endif
convert_to_string_ex(language);