felipe          Fri Jun 27 02:58:13 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/pspell pspell.c 
    /php-src/ext/pspell/tests   002.phpt 
  Log:
  - New parameter parsing API
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/pspell.c?r1=1.45.2.4.2.7.2.2&r2=1.45.2.4.2.7.2.3&diff_format=u
Index: php-src/ext/pspell/pspell.c
diff -u php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.2 
php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.3
--- php-src/ext/pspell/pspell.c:1.45.2.4.2.7.2.2        Mon Dec 31 07:17:12 2007
+++ php-src/ext/pspell/pspell.c Fri Jun 27 02:58:12 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: pspell.c,v 1.45.2.4.2.7.2.2 2007/12/31 07:17:12 sebastian Exp $ */
+/* $Id: pspell.c,v 1.45.2.4.2.7.2.3 2008/06/27 02:58:12 felipe Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -124,18 +124,16 @@
 }
 
 #define PSPELL_FETCH_CONFIG \
-       convert_to_long_ex(conf);       \
-       config = (PspellConfig *) zend_list_find(Z_LVAL_PP(conf), &type);       
\
+       config = (PspellConfig *) zend_list_find(conf, &type);  \
        if (config == NULL || type != le_pspell_config) {       \
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a 
PSPELL config index", Z_LVAL_PP(conf));       \
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a 
PSPELL config index", conf);  \
                RETURN_FALSE;   \
        }       \
 
 #define PSPELL_FETCH_MANAGER \
-       convert_to_long_ex(scin);       \
-       manager = (PspellManager *) zend_list_find(Z_LVAL_PP(scin), &type);     
\
+       manager = (PspellManager *) zend_list_find(scin, &type);        \
        if (!manager || type != le_pspell) {    \
-               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a 
PSPELL result index", Z_LVAL_PP(scin));       \
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "%ld is not a 
PSPELL result index", scin);  \
                RETURN_FALSE;   \
        }       \
 
@@ -157,9 +155,10 @@
    Load a dictionary */
 static PHP_FUNCTION(pspell_new)
 {
-       zval **language,**spelling,**jargon,**encoding,**pmode;
+       char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL;
+       int language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
        long mode = 0L,  speed = 0L;
-       int argc;
+       int argc = ZEND_NUM_ARGS();
        int ind;
 
 #ifdef PHP_WIN32
@@ -174,9 +173,9 @@
        PspellManager *manager;
        PspellConfig *config;
        
-       argc = ZEND_NUM_ARGS();
-       if (argc < 1 || argc > 5 || 
zend_get_parameters_ex(argc,&language,&spelling,&jargon,&encoding,&pmode) == 
FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(argc TSRMLS_CC, "s|sssl", &language, 
&language_len, &spelling, &spelling_len,
+               &jargon, &jargon_len, &encoding, &encoding_len, &mode) == 
FAILURE) {
+               return;
        }
 
        config = new_pspell_config();
@@ -202,33 +201,21 @@
        }
 #endif
 
-       convert_to_string_ex(language);
-       pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));
+       pspell_config_replace(config, "language-tag", language);
 
-       if(argc > 1){
-               convert_to_string_ex(spelling);
-               if(Z_STRLEN_PP(spelling) > 0){
-                       pspell_config_replace(config, "spelling", 
Z_STRVAL_PP(spelling));
-               }
+       if (spelling_len) {
+               pspell_config_replace(config, "spelling", spelling);
        }
 
-       if(argc > 2){
-               convert_to_string_ex(jargon);
-               if(Z_STRLEN_PP(jargon) > 0){
-                       pspell_config_replace(config, "jargon", 
Z_STRVAL_PP(jargon));
-               }
+       if (jargon_len) {
+               pspell_config_replace(config, "jargon", jargon);
        }
 
-       if(argc > 3){
-               convert_to_string_ex(encoding);
-               if(Z_STRLEN_PP(encoding) > 0){
-                       pspell_config_replace(config, "encoding", 
Z_STRVAL_PP(encoding));
-               }
+       if (encoding_len) {
+               pspell_config_replace(config, "encoding", encoding);
        }
 
-       if(argc > 4){
-               convert_to_long_ex(pmode);
-               mode = Z_LVAL_PP(pmode);
+       if (argc > 4) {
                speed = mode & PSPELL_SPEED_MASK_INTERNAL;
 
                /* First check what mode we want (how many suggestions) */
@@ -265,9 +252,10 @@
    Load a dictionary with a personal wordlist*/
 static PHP_FUNCTION(pspell_new_personal)
 {
-       zval **personal, **language,**spelling,**jargon,**encoding,**pmode;
+       char *personal, *language, *spelling = NULL, *jargon = NULL, *encoding 
= NULL;
+       int personal_len, language_len, spelling_len = 0, jargon_len = 0, 
encoding_len = 0;
        long mode = 0L,  speed = 0L;
-       int argc;
+       int argc = ZEND_NUM_ARGS();
        int ind;
 
 #ifdef PHP_WIN32
@@ -281,10 +269,10 @@
        PspellCanHaveError *ret;
        PspellManager *manager;
        PspellConfig *config;
-       
-       argc = ZEND_NUM_ARGS();
-       if (argc < 2 || argc > 6 || 
zend_get_parameters_ex(argc,&personal,&language,&spelling,&jargon,&encoding,&pmode)
 == FAILURE) {
-               WRONG_PARAM_COUNT;
+
+       if (zend_parse_parameters(argc TSRMLS_CC, "ss|sssl", &personal, 
&personal_len, &language, &language_len, 
+               &spelling, &spelling_len, &jargon, &jargon_len, &encoding, 
&encoding_len, &mode) == FAILURE) {
+               return;
        }
 
        config = new_pspell_config();
@@ -310,48 +298,34 @@
        }
 #endif
 
-       convert_to_string_ex(personal);
-
-       if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(personal), NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
+       if (PG(safe_mode) && (!php_checkuid(personal, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
                delete_pspell_config(config);
                RETURN_FALSE;
        }
 
-       if (php_check_open_basedir(Z_STRVAL_PP(personal) TSRMLS_CC)) {
+       if (php_check_open_basedir(personal TSRMLS_CC)) {
                delete_pspell_config(config);
                RETURN_FALSE;
        }
 
-       pspell_config_replace(config, "personal", Z_STRVAL_PP(personal));
+       pspell_config_replace(config, "personal", personal);
        pspell_config_replace(config, "save-repl", "false");
 
-       convert_to_string_ex(language);
-       pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));
+       pspell_config_replace(config, "language-tag", language);
 
-       if(argc > 2){
-               convert_to_string_ex(spelling);
-               if(Z_STRLEN_PP(spelling) > 0){
-                       pspell_config_replace(config, "spelling", 
Z_STRVAL_PP(spelling));
-               }
+       if (spelling_len) {
+               pspell_config_replace(config, "spelling", spelling);
        }
 
-       if(argc > 3){
-               convert_to_string_ex(jargon);
-               if(Z_STRLEN_PP(jargon) > 0){
-                       pspell_config_replace(config, "jargon", 
Z_STRVAL_PP(jargon));
-               }
+       if (jargon_len) {
+               pspell_config_replace(config, "jargon", jargon);
        }
 
-       if(argc > 4){
-               convert_to_string_ex(encoding);
-               if(Z_STRLEN_PP(encoding) > 0){
-                       pspell_config_replace(config, "encoding", 
Z_STRVAL_PP(encoding));
-               }
+       if (encoding_len) {
+               pspell_config_replace(config, "encoding", encoding);
        }
 
-       if(argc > 5){
-               convert_to_long_ex(pmode);
-               mode = Z_LVAL_PP(pmode);
+       if (argc > 5) {
                speed = mode & PSPELL_SPEED_MASK_INTERNAL;
 
                /* First check what mode we want (how many suggestions) */
@@ -388,18 +362,15 @@
    Load a dictionary based on the given config */
 static PHP_FUNCTION(pspell_new_config)
 {
-       int type;
-       zval **conf;
-       int argc;
-       int ind;
+       int type, ind;
+       long conf;
        
        PspellCanHaveError *ret;
        PspellManager *manager;
        PspellConfig *config;
        
-       argc = ZEND_NUM_ARGS();
-       if (argc != 1 || zend_get_parameters_ex(argc,&conf) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &conf) == 
FAILURE) {
+               return;
        }
 
        PSPELL_FETCH_CONFIG;
@@ -422,23 +393,20 @@
    Returns true if word is valid */
 static PHP_FUNCTION(pspell_check)
 {
-       int type;
-       zval **scin,**word;
+       int type, word_len;
+       long scin;
+       char *word;
        PspellManager *manager;
 
-       int argc;
-       argc = ZEND_NUM_ARGS();
-       if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, 
&word, &word_len) == FAILURE) {
+               return;
        }
-    
-       convert_to_string_ex(word);
 
        PSPELL_FETCH_MANAGER;
 
-       if(pspell_manager_check(manager, Z_STRVAL_PP(word))){
+       if (pspell_manager_check(manager, word)) {
                RETURN_TRUE;
-       }else{
+       } else {
                RETURN_FALSE;
        }
 }
@@ -448,24 +416,23 @@
    Returns array of suggestions */
 static PHP_FUNCTION(pspell_suggest)
 {
-       zval **scin, **word;
-       int argc;
+       long scin;
+       char *word;
+       int word_len;
        PspellManager *manager;
        int type;
        const PspellWordList *wl;
        const char *sug;
 
-       argc = ZEND_NUM_ARGS();
-       if(argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, 
&word, &word_len) == FAILURE) {
+               return;
        }
-    
-       convert_to_string_ex(word);
+
        PSPELL_FETCH_MANAGER;
 
        array_init(return_value);
 
-       wl = pspell_manager_suggest(manager, Z_STRVAL_PP(word));
+       wl = pspell_manager_suggest(manager, word);
        if(wl){
                PspellStringEmulation *els = pspell_word_list_elements(wl);
                while((sug = pspell_string_emulation_next(els)) != 0){
@@ -483,21 +450,18 @@
    Notify the dictionary of a user-selected replacement */
 static PHP_FUNCTION(pspell_store_replacement)
 {
-       int type;
-       zval **scin,**miss,**corr;
+       int type, miss_len, corr_len;
+       long scin;
+       char *miss, *corr;
        PspellManager *manager;
 
-       int argc;
-       argc = ZEND_NUM_ARGS();
-       if (argc != 3 || zend_get_parameters_ex(argc, &scin,&miss,&corr) == 
FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lss", &scin, 
&miss, &miss_len, &corr, &corr_len) == FAILURE) {
+               return;
        }
-    
-       convert_to_string_ex(miss);
-       convert_to_string_ex(corr);
+
        PSPELL_FETCH_MANAGER;
 
-       pspell_manager_store_replacement(manager, Z_STRVAL_PP(miss), 
Z_STRVAL_PP(corr));
+       pspell_manager_store_replacement(manager, miss, corr);
        if(pspell_manager_error_number(manager) == 0){
                RETURN_TRUE;
        }else{
@@ -511,25 +475,23 @@
    Adds a word to a personal list */
 static PHP_FUNCTION(pspell_add_to_personal)
 {
-       int type;
-       zval **scin,**word;
+       int type, word_len;
+       long scin;
+       char *word;
        PspellManager *manager;
 
-       int argc;
-       argc = ZEND_NUM_ARGS();
-       if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, 
&word, &word_len) == FAILURE) {
+               return;
        }
-    
-       convert_to_string_ex(word);
+
        PSPELL_FETCH_MANAGER;
 
        /*If the word is empty, we have to return; otherwise we'll segfault! 
ouch!*/
-       if(Z_STRLEN_PP(word) == 0){
+       if (word_len == 0){
                RETURN_FALSE;
        }
        
-       pspell_manager_add_to_personal(manager, Z_STRVAL_PP(word));
+       pspell_manager_add_to_personal(manager, word);
        if(pspell_manager_error_number(manager) == 0){
                RETURN_TRUE;
        }else{
@@ -543,25 +505,23 @@
    Adds a word to the current session */
 static PHP_FUNCTION(pspell_add_to_session)
 {
-       int type;
-       zval **scin,**word;
+       int type, word_len;
+       long scin;
+       char *word;
        PspellManager *manager;
 
-       int argc;
-       argc = ZEND_NUM_ARGS();
-       if (argc != 2 || zend_get_parameters_ex(argc, &scin,&word) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &scin, 
&word, &word_len) == FAILURE) {
+               return;
        }
-    
-       convert_to_string_ex(word);
+
        PSPELL_FETCH_MANAGER;
 
        /*If the word is empty, we have to return; otherwise we'll segfault! 
ouch!*/
-       if(Z_STRLEN_PP(word) == 0){
+       if (word_len == 0){
                RETURN_FALSE;
        }
 
-       pspell_manager_add_to_session(manager, Z_STRVAL_PP(word));
+       pspell_manager_add_to_session(manager, word);
        if(pspell_manager_error_number(manager) == 0){
                RETURN_TRUE;
        }else{
@@ -576,13 +536,11 @@
 static PHP_FUNCTION(pspell_clear_session)
 {
        int type;
-       zval **scin;
+       long scin;
        PspellManager *manager;
 
-       int argc;
-       argc = ZEND_NUM_ARGS();
-       if (argc != 1 || zend_get_parameters_ex(argc, &scin) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scin) == 
FAILURE) {
+               return;
        }
     
        PSPELL_FETCH_MANAGER;   
@@ -602,13 +560,11 @@
 static PHP_FUNCTION(pspell_save_wordlist)
 {
        int type;
-       zval **scin;
+       long scin;
        PspellManager *manager;
 
-       int argc;
-       argc = ZEND_NUM_ARGS();
-       if (argc != 1 || zend_get_parameters_ex(argc, &scin) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &scin) == 
FAILURE) {
+               return;
        }
     
        PSPELL_FETCH_MANAGER;   
@@ -629,8 +585,8 @@
    Create a new config to be used later to create a manager */
 static PHP_FUNCTION(pspell_config_create)
 {
-       zval **language,**spelling,**jargon,**encoding;
-       int argc;
+       char *language, *spelling = NULL, *jargon = NULL, *encoding = NULL;
+       int language_len, spelling_len = 0, jargon_len = 0, encoding_len = 0;
        int ind;
 
        PspellConfig *config;
@@ -643,9 +599,9 @@
        DWORD dwType,dwLen;
 #endif
        
-       argc = ZEND_NUM_ARGS();
-       if (argc < 1 || argc > 4 || 
zend_get_parameters_ex(argc,&language,&spelling,&jargon,&encoding) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sss", 
&language, &language_len, &spelling, &spelling_len, 
+               &jargon, &jargon_len, &encoding, &encoding_len) == FAILURE) {
+               return;
        }
 
        config = new_pspell_config();
@@ -671,28 +627,18 @@
        }
 #endif
 
-       convert_to_string_ex(language);
-       pspell_config_replace(config, "language-tag", Z_STRVAL_PP(language));
+       pspell_config_replace(config, "language-tag", language);
 
-       if(argc > 1){
-               convert_to_string_ex(spelling);
-               if(Z_STRLEN_PP(spelling) > 0){
-                       pspell_config_replace(config, "spelling", 
Z_STRVAL_PP(spelling));
-               }
+       if (spelling_len) {
+               pspell_config_replace(config, "spelling", spelling);
        }
 
-       if(argc > 2){
-               convert_to_string_ex(jargon);
-               if(Z_STRLEN_PP(jargon) > 0){
-                       pspell_config_replace(config, "jargon", 
Z_STRVAL_PP(jargon));
-               }
+       if (jargon_len){
+               pspell_config_replace(config, "jargon", jargon);
        }
 
-       if(argc > 3){
-               convert_to_string_ex(encoding);
-               if(Z_STRLEN_PP(encoding) > 0){
-                       pspell_config_replace(config, "encoding", 
Z_STRVAL_PP(encoding));
-               }
+       if (encoding_len) {
+               pspell_config_replace(config, "encoding", encoding);
        }
 
        /* By default I do not want to write anything anywhere because it'll 
try to write to $HOME
@@ -709,20 +655,20 @@
 static PHP_FUNCTION(pspell_config_runtogether)
 {
        int type;
-       zval **conf, **runtogether;
+       long conf;
+       zend_bool runtogether;
        int argc;
 
        PspellConfig *config;
        
        argc = ZEND_NUM_ARGS();
-       if (argc != 2 || zend_get_parameters_ex(argc,&conf,&runtogether) == 
FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &conf, 
&runtogether) == FAILURE) {
+               return;
        }
 
        PSPELL_FETCH_CONFIG;    
 
-       convert_to_boolean_ex(runtogether);
-       pspell_config_replace(config, "run-together", Z_LVAL_PP(runtogether) ? 
"true" : "false");
+       pspell_config_replace(config, "run-together", runtogether ? "true" : 
"false");
        
        RETURN_TRUE;
 }
@@ -733,26 +679,22 @@
 static PHP_FUNCTION(pspell_config_mode)
 {
        int type;
-       zval **conf, **mode;
-       int argc;
+       long conf, mode;
 
        PspellConfig *config;
-       
-       argc = ZEND_NUM_ARGS();
-       if (argc != 2 || zend_get_parameters_ex(argc,&conf,&mode) == FAILURE) {
-               WRONG_PARAM_COUNT;
+
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &conf, 
&mode) == FAILURE) {
+               return;
        }
 
        PSPELL_FETCH_CONFIG;
 
-       convert_to_long_ex(mode);
-
        /* First check what mode we want (how many suggestions) */
-       if(Z_LVAL_PP(mode) == PSPELL_FAST){
+       if (mode == PSPELL_FAST){
                pspell_config_replace(config, "sug-mode", "fast");
-       }else if(Z_LVAL_PP(mode) == PSPELL_NORMAL){
+       }else if (mode == PSPELL_NORMAL){
                pspell_config_replace(config, "sug-mode", "normal");
-       }else if(Z_LVAL_PP(mode) == PSPELL_BAD_SPELLERS){
+       }else if (mode == PSPELL_BAD_SPELLERS){
                pspell_config_replace(config, "sug-mode", "bad-spellers");
        }
 
@@ -765,7 +707,7 @@
 static PHP_FUNCTION(pspell_config_ignore)
 {
        int type;
-       zval **conf, **pignore;
+       long conf, pignore;
        int argc;
 
        char ignore_str[MAX_LENGTH_OF_LONG + 1];        
@@ -774,14 +716,13 @@
        PspellConfig *config;
        
        argc = ZEND_NUM_ARGS();
-       if (argc != 2 || zend_get_parameters_ex(argc,&conf,&pignore) == 
FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ll", &conf, 
&pignore) == FAILURE) {
+               return;
        }
 
        PSPELL_FETCH_CONFIG;
 
-       convert_to_long_ex(pignore);
-       ignore = Z_LVAL_PP(pignore);
+       ignore = pignore;
 
        snprintf(ignore_str, sizeof(ignore_str), "%ld", ignore);
 
@@ -793,28 +734,26 @@
 static void pspell_config_path(INTERNAL_FUNCTION_PARAMETERS, char *option)
 {
        int type;
-       zval **conf, **value;
-       int argc;
+       long conf;
+       char *value;
+       int value_len;
        PspellConfig *config;
        
-       argc = ZEND_NUM_ARGS();
-       if (argc != 2 || zend_get_parameters_ex(argc, &conf, &value) == 
FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &conf, 
&value, &value_len) == FAILURE) {
+               return;
        }
 
        PSPELL_FETCH_CONFIG;
 
-       convert_to_string_ex(value);
-
-       if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(value), NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
+       if (PG(safe_mode) && (!php_checkuid(value, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
                RETURN_FALSE;
        }
 
-       if (php_check_open_basedir(Z_STRVAL_PP(value) TSRMLS_CC)) {
+       if (php_check_open_basedir(value TSRMLS_CC)) {
                RETURN_FALSE;
        }
 
-       pspell_config_replace(config, option, Z_STRVAL_PP(value));
+       pspell_config_replace(config, option, value);
 
        RETURN_TRUE;
 }
@@ -848,31 +787,29 @@
 static PHP_FUNCTION(pspell_config_repl)
 {
        int type;
-       zval **conf, **repl;
-       int argc;
+       long conf;
+       char *repl;
+       int repl_len;
 
        PspellConfig *config;
        
-       argc = ZEND_NUM_ARGS();
-       if (argc != 2 || zend_get_parameters_ex(argc,&conf,&repl) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ls", &conf, 
&repl, &repl_len) == FAILURE) {
+               return;
        }
 
        PSPELL_FETCH_CONFIG;
 
        pspell_config_replace(config, "save-repl", "true");
 
-       convert_to_string_ex(repl);
-
-       if (PG(safe_mode) && (!php_checkuid(Z_STRVAL_PP(repl), NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
+       if (PG(safe_mode) && (!php_checkuid(repl, NULL, 
CHECKUID_CHECK_FILE_AND_DIR))) {
                RETURN_FALSE;
        }
 
-       if (php_check_open_basedir(Z_STRVAL_PP(repl) TSRMLS_CC)) {
+       if (php_check_open_basedir(repl TSRMLS_CC)) {
                RETURN_FALSE;
        }
 
-       pspell_config_replace(config, "repl", Z_STRVAL_PP(repl));
+       pspell_config_replace(config, "repl", repl);
 
        RETURN_TRUE;
 }
@@ -883,20 +820,18 @@
 static PHP_FUNCTION(pspell_config_save_repl)
 {
        int type;
-       zval **conf, **save;
-       int argc;
+       long conf;
+       zend_bool save;
 
        PspellConfig *config;
        
-       argc = ZEND_NUM_ARGS();
-       if (argc != 2 || zend_get_parameters_ex(argc,&conf,&save) == FAILURE) {
-               WRONG_PARAM_COUNT;
+       if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lb", &conf, 
&save) == FAILURE) {
+               return;
        }
 
        PSPELL_FETCH_CONFIG;
 
-       convert_to_boolean_ex(save);
-       pspell_config_replace(config, "save-repl", Z_LVAL_PP(save) ? "true" : 
"false");
+       pspell_config_replace(config, "save-repl", save ? "true" : "false");
 
        RETURN_TRUE;
 }
http://cvs.php.net/viewvc.cgi/php-src/ext/pspell/tests/002.phpt?r1=1.1.2.2&r2=1.1.2.2.2.1&diff_format=u
Index: php-src/ext/pspell/tests/002.phpt
diff -u php-src/ext/pspell/tests/002.phpt:1.1.2.2 
php-src/ext/pspell/tests/002.phpt:1.1.2.2.2.1
--- php-src/ext/pspell/tests/002.phpt:1.1.2.2   Thu Jun 29 22:54:31 2006
+++ php-src/ext/pspell/tests/002.phpt   Fri Jun 27 02:58:13 2008
@@ -29,16 +29,14 @@
 }
 ?>
 --EXPECTF--
-Warning: Wrong parameter count for pspell_check() in %s002.php on line 5
+Warning: pspell_check() expects exactly 2 parameters, 1 given in %s on line %d
 NULL
 bool(false)
 bool(false)
 bool(true)
 bool(true)
 
-Notice: Object of class stdClass could not be converted to int in %s002.php on 
line 12
-
-Warning: pspell_clear_session(): 1 is not a PSPELL result index in %s002.php 
on line 12
-bool(false)
+Warning: pspell_clear_session() expects parameter 1 to be long, object given 
in %s on line %d
+NULL
 bool(true)
 bool(false)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to