]> granicus.if.org Git - php/commitdiff
Fix segfault in pspell_new_config(). Also fix grammar
authorJay Smith <jay@php.net>
Wed, 21 May 2003 23:04:18 +0000 (23:04 +0000)
committerJay Smith <jay@php.net>
Wed, 21 May 2003 23:04:18 +0000 (23:04 +0000)
in error messages.

ext/pspell/pspell.c

index 1d1a6436a97c56e0d0d8a9d6a57368599f4ee915..c98b8a0362148255e28441fa3c451ba7a5b2259b 100644 (file)
@@ -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;
        }