summaryrefslogtreecommitdiff
path: root/ext/pspell/pspell.c
diff options
context:
space:
mode:
authorJay Smith <jay@php.net>2003-05-21 23:04:18 +0000
committerJay Smith <jay@php.net>2003-05-21 23:04:18 +0000
commit1611ebd45e14ba5b93353eece677ca7fccc5e5ae (patch)
tree31d67549bb92717affee6fb109090d5651cbe003 /ext/pspell/pspell.c
parent66b91259684beab659f4cdb6c3083d2ad7114816 (diff)
downloadphp-git-1611ebd45e14ba5b93353eece677ca7fccc5e5ae.tar.gz
Fix segfault in pspell_new_config(). Also fix grammar
in error messages.
Diffstat (limited to 'ext/pspell/pspell.c')
-rw-r--r--ext/pspell/pspell.c32
1 files changed, 19 insertions, 13 deletions
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
index 1d1a6436a9..c98b8a0362 100644
--- a/ext/pspell/pspell.c
+++ b/ext/pspell/pspell.c
@@ -288,6 +288,12 @@ PHP_FUNCTION(pspell_new_config)
convert_to_long_ex(conf);
config = (PspellConfig *) zend_list_find(Z_LVAL_PP(conf), &type);
+
+ if (config == NULL || type != le_pspell_config) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL config index", Z_LVAL_PP(conf));
+ RETURN_FALSE;
+ }
+
ret = new_pspell_manager(config);
if(pspell_error_number(ret) != 0){
@@ -319,7 +325,7 @@ PHP_FUNCTION(pspell_check)
convert_to_string_ex(word);
manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL result index",Z_LVAL_PP(scin));
RETURN_FALSE;
}
@@ -351,7 +357,7 @@ PHP_FUNCTION(pspell_suggest)
convert_to_string_ex(word);
manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL result index",Z_LVAL_PP(scin));
RETURN_FALSE;
}
@@ -390,7 +396,7 @@ PHP_FUNCTION(pspell_store_replacement)
convert_to_string_ex(corr);
manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL result index",Z_LVAL_PP(scin));
RETURN_FALSE;
}
@@ -422,7 +428,7 @@ PHP_FUNCTION(pspell_add_to_personal)
convert_to_string_ex(word);
manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL result index",Z_LVAL_PP(scin));
RETURN_FALSE;
}
@@ -459,7 +465,7 @@ PHP_FUNCTION(pspell_add_to_session)
convert_to_string_ex(word);
manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL result index",Z_LVAL_PP(scin));
RETURN_FALSE;
}
@@ -495,7 +501,7 @@ PHP_FUNCTION(pspell_clear_session)
convert_to_long_ex(scin);
manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL result index",Z_LVAL_PP(scin));
RETURN_FALSE;
}
@@ -526,7 +532,7 @@ PHP_FUNCTION(pspell_save_wordlist)
convert_to_long_ex(scin);
manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);
if(!manager){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL result index",Z_LVAL_PP(scin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL result index",Z_LVAL_PP(scin));
RETURN_FALSE;
}
@@ -609,7 +615,7 @@ PHP_FUNCTION(pspell_config_runtogether)
convert_to_long_ex(sccin);
config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL config index",Z_LVAL_PP(sccin));
RETURN_FALSE;
}
@@ -638,7 +644,7 @@ PHP_FUNCTION(pspell_config_mode)
convert_to_long_ex(sccin);
config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL config index",Z_LVAL_PP(sccin));
RETURN_FALSE;
}
@@ -680,7 +686,7 @@ PHP_FUNCTION(pspell_config_ignore)
convert_to_long_ex(sccin);
config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL config index",Z_LVAL_PP(sccin));
RETURN_FALSE;
}
@@ -726,7 +732,7 @@ PHP_FUNCTION(pspell_config_personal)
convert_to_long_ex(sccin);
config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL config index",Z_LVAL_PP(sccin));
RETURN_FALSE;
}
@@ -755,7 +761,7 @@ PHP_FUNCTION(pspell_config_repl)
convert_to_long_ex(sccin);
config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL config index",Z_LVAL_PP(sccin));
RETURN_FALSE;
}
@@ -786,7 +792,7 @@ PHP_FUNCTION(pspell_config_save_repl)
convert_to_long_ex(sccin);
config = (PspellConfig *) zend_list_find(Z_LVAL_PP(sccin), &type);
if(!config){
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not an PSPELL config index",Z_LVAL_PP(sccin));
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%d is not a PSPELL config index",Z_LVAL_PP(sccin));
RETURN_FALSE;
}