From: Xinchen Hui Date: Wed, 21 May 2014 03:40:19 +0000 (+0800) Subject: Refactored ext/dba (tests passes, but segfaults need to be fixed) X-Git-Tag: POST_PHPNG_MERGE~313 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6d12d3bae12682e66cc45de56b3bb6d07c038575;p=php Refactored ext/dba (tests passes, but segfaults need to be fixed) --- diff --git a/ext/dba/dba.c b/ext/dba/dba.c index 66a6bee479..b04a2ee7cd 100644 --- a/ext/dba/dba.c +++ b/ext/dba/dba.c @@ -203,7 +203,7 @@ ZEND_GET_MODULE(dba) static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS_DC) { if (Z_TYPE_P(key) == IS_ARRAY) { - zval **group, **name; + zval *group, *name; HashPosition pos; size_t len; @@ -212,30 +212,30 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS return -1; } zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(key), &pos); - zend_hash_get_current_data_ex(Z_ARRVAL_P(key), (void **) &group, &pos); + group = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos); zend_hash_move_forward_ex(Z_ARRVAL_P(key), &pos); - zend_hash_get_current_data_ex(Z_ARRVAL_P(key), (void **) &name, &pos); + name = zend_hash_get_current_data_ex(Z_ARRVAL_P(key), &pos); convert_to_string_ex(group); convert_to_string_ex(name); - if (Z_STRLEN_PP(group) == 0) { - *key_str = Z_STRVAL_PP(name); + if (Z_STRLEN_P(group) == 0) { + *key_str = Z_STRVAL_P(name); *key_free = NULL; - return Z_STRLEN_PP(name); + return Z_STRLEN_P(name); } - len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_PP(group), Z_STRVAL_PP(name)); + len = spprintf(key_str, 0, "[%s]%s", Z_STRVAL_P(group), Z_STRVAL_P(name)); *key_free = *key_str; return len; } else { - zval tmp = *key; + zval tmp; int len; - zval_copy_ctor(&tmp); + ZVAL_COPY(&tmp, key); convert_to_string(&tmp); *key_free = *key_str = estrndup(Z_STRVAL(tmp), Z_STRLEN(tmp)); len = Z_STRLEN(tmp); - zval_dtor(&tmp); + zval_ptr_dtor(&tmp); return len; } } @@ -279,8 +279,8 @@ static size_t php_dba_make_key(zval *key, char **key_str, char **key_free TSRMLS #define DBA_FETCH_RESOURCE(info, id) \ ZEND_FETCH_RESOURCE2(info, dba_info *, id, -1, "DBA identifier", le_db, le_pdb); -#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_FETCH_RESOURCE(info, &id) -#define DBA_ID_GET2_3 DBA_ID_PARS; DBA_GET2_3; DBA_FETCH_RESOURCE(info, &id) +#define DBA_ID_GET2 DBA_ID_PARS; DBA_GET2; DBA_FETCH_RESOURCE(info, id) +#define DBA_ID_GET2_3 DBA_ID_PARS; DBA_GET2_3; DBA_FETCH_RESOURCE(info, id) #define DBA_ID_DONE \ if (key_free) efree(key_free) @@ -416,7 +416,7 @@ static void dba_close(dba_info *info TSRMLS_DC) if (info->path) { pefree(info->path, info->flags&DBA_PERSISTENT); } - if (info->fp && info->fp!=info->lock.fp) { + if (info->fp && info->fp != info->lock.fp) { if(info->flags&DBA_PERSISTENT) { php_stream_pclose(info->fp); } else { @@ -424,7 +424,7 @@ static void dba_close(dba_info *info TSRMLS_DC) } } if (info->lock.fp) { - if(info->flags&DBA_PERSISTENT) { + if(info->flags & DBA_PERSISTENT) { php_stream_pclose(info->lock.fp); } else { php_stream_close(info->lock.fp); @@ -439,28 +439,30 @@ static void dba_close(dba_info *info TSRMLS_DC) /* {{{ dba_close_rsrc */ -static void dba_close_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC) +static void dba_close_rsrc(zend_resource *rsrc TSRMLS_DC) { dba_info *info = (dba_info *)rsrc->ptr; - dba_close(info TSRMLS_CC); + if (info) { + dba_close(info TSRMLS_CC); + } } /* }}} */ /* {{{ dba_close_pe_rsrc_deleter */ -int dba_close_pe_rsrc_deleter(zend_rsrc_list_entry *le, void *pDba TSRMLS_DC) +int dba_close_pe_rsrc_deleter(zval *el, void *pDba TSRMLS_DC) { - return le->ptr == pDba; + return ((zend_resource *)Z_PTR_P(el))->ptr == pDba; } /* }}} */ /* {{{ dba_close_pe_rsrc */ -static void dba_close_pe_rsrc(zend_rsrc_list_entry *rsrc TSRMLS_DC) +static void dba_close_pe_rsrc(zend_resource *rsrc TSRMLS_DC) { dba_info *info = (dba_info *)rsrc->ptr; /* closes the resource by calling dba_close_rsrc() */ - zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) dba_close_pe_rsrc_deleter, info TSRMLS_CC); + zend_hash_apply_with_argument(&EG(persistent_list), dba_close_pe_rsrc_deleter, info TSRMLS_CC); } /* }}} */ @@ -535,9 +537,9 @@ PHP_MINFO_FUNCTION(dba) php_info_print_table_start(); php_info_print_table_row(2, "DBA support", "enabled"); - if (handlers.c) { + if (handlers.s) { smart_str_0(&handlers); - php_info_print_table_row(2, "Supported handlers", handlers.c); + php_info_print_table_row(2, "Supported handlers", handlers.s->val); smart_str_free(&handlers); } else { php_info_print_table_row(2, "Supported handlers", "none"); @@ -568,7 +570,7 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode) RETURN_FALSE; } - DBA_FETCH_RESOURCE(info, &id); + DBA_FETCH_RESOURCE(info, id); DBA_WRITE_CHECK_WITH_ID; @@ -582,22 +584,22 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode) } /* }}} */ -#define FREENOW if(args) efree(args); if(key) efree(key) +#define FREENOW if(args) {int i; for (i=0; itype == le_db || le->type == le_pdb) { info = (dba_info *)(le->ptr); if (!strcmp(info->path, path)) { return (dba_info *)(le->ptr); @@ -613,7 +615,7 @@ dba_info *php_dba_find(const char* path TSRMLS_DC) */ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) { - zval ***args = (zval ***) NULL; + zval *args = NULL; int ac = ZEND_NUM_ARGS(); dba_mode_t modenr; dba_info *info, *other; @@ -628,25 +630,29 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) char *opened_path = NULL; char *lock_name; - if(ac < 2) { + if (ac < 2) { WRONG_PARAM_COUNT; } /* we pass additional args to the respective handler */ - args = safe_emalloc(ac, sizeof(zval *), 0); + args = safe_emalloc(ac, sizeof(zval), 0); if (zend_get_parameters_array_ex(ac, args) != SUCCESS) { - FREENOW; + efree(args); WRONG_PARAM_COUNT; } /* we only take string arguments */ for (i = 0; i < ac; i++) { - convert_to_string_ex(args[i]); - keylen += Z_STRLEN_PP(args[i]); + if (Z_TYPE(args[i]) != IS_STRING) { + convert_to_string_ex(&args[i]); + } else if (Z_REFCOUNTED(args[i])) { + Z_ADDREF(args[i]); + } + keylen += Z_STRLEN(args[i]); } if (persistent) { - zend_rsrc_list_entry *le; + zend_resource *le; /* calculate hash */ key = safe_emalloc(keylen, 1, 1); @@ -654,15 +660,15 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) keylen = 0; for(i = 0; i < ac; i++) { - memcpy(key+keylen, Z_STRVAL_PP(args[i]), Z_STRLEN_PP(args[i])); - keylen += Z_STRLEN_PP(args[i]); + memcpy(key+keylen, Z_STRVAL(args[i]), Z_STRLEN(args[i])); + keylen += Z_STRLEN(args[i]); } /* try to find if we already have this link in our persistent list */ - if (zend_hash_find(&EG(persistent_list), key, keylen+1, (void **) &le) == SUCCESS) { + if ((le = zend_hash_str_find_ptr(&EG(persistent_list), key, keylen)) != NULL) { FREENOW; - if (Z_TYPE_P(le) != le_pdb) { + if (le->type != le_pdb) { RETURN_FALSE; } @@ -676,16 +682,16 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (ac==2) { hptr = DBA_G(default_hptr); if (!hptr) { - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "No default handler selected"); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "No default handler selected"); FREENOW; RETURN_FALSE; } } else { - for (hptr = handler; hptr->name && strcasecmp(hptr->name, Z_STRVAL_PP(args[2])); hptr++); + for (hptr = handler; hptr->name && strcasecmp(hptr->name, Z_STRVAL(args[2])); hptr++); } if (!hptr->name) { - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "No such handler: %s", Z_STRVAL_PP(args[2])); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "No such handler: %s", Z_STRVAL(args[2])); FREENOW; RETURN_FALSE; } @@ -702,7 +708,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) * * t: test open database, warning if locked */ - strlcpy(mode, Z_STRVAL_PP(args[1]), sizeof(mode)); + strlcpy(mode, Z_STRVAL(args[1]), sizeof(mode)); pmode = &mode[0]; if (pmode[0] && (pmode[1]=='d' || pmode[1]=='l' || pmode[1]=='-')) { /* force lock on db file or lck file or disable locking */ switch (pmode[1]) { @@ -716,13 +722,13 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) case 'l': lock_flag = DBA_LOCK_ALL; if ((hptr->flags & DBA_LOCK_ALL) == 0) { - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_NOTICE, "Handler %s does locking internally", hptr->name); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_NOTICE, "Handler %s does locking internally", hptr->name); } break; default: case '-': if ((hptr->flags & DBA_LOCK_ALL) == 0) { - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Locking cannot be disabled for handler %s", hptr->name); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "Locking cannot be disabled for handler %s", hptr->name); FREENOW; RETURN_FALSE; } @@ -771,7 +777,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) file_mode = "w+b"; break; default: - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Illegal DBA mode"); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "Illegal DBA mode"); FREENOW; RETURN_FALSE; } @@ -784,17 +790,17 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (*pmode=='t') { pmode++; if (!lock_flag) { - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "You cannot combine modifiers - (no lock) and t (test lock)"); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "You cannot combine modifiers - (no lock) and t (test lock)"); FREENOW; RETURN_FALSE; } if (!lock_mode) { if ((hptr->flags & DBA_LOCK_ALL) == 0) { - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Handler %s uses its own locking which doesn't support mode modifier t (test lock)", hptr->name); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "Handler %s uses its own locking which doesn't support mode modifier t (test lock)", hptr->name); FREENOW; RETURN_FALSE; } else { - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Handler %s doesn't uses locking for this mode which makes modifier t (test lock) obsolete", hptr->name); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "Handler %s doesn't uses locking for this mode which makes modifier t (test lock) obsolete", hptr->name); FREENOW; RETURN_FALSE; } @@ -803,14 +809,14 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) } } if (*pmode) { - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Illegal DBA mode"); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "Illegal DBA mode"); FREENOW; RETURN_FALSE; } info = pemalloc(sizeof(dba_info), persistent); memset(info, 0, sizeof(dba_info)); - info->path = pestrdup(Z_STRVAL_PP(args[0]), persistent); + info->path = pestrdup(Z_STRVAL(args[0]), persistent); info->mode = modenr; info->argc = ac - 3; info->argv = args + 3; @@ -833,7 +839,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (!error && lock_mode) { if (lock_dbf) { - lock_name = Z_STRVAL_PP(args[0]); + lock_name = Z_STRVAL(args[0]); } else { spprintf(&lock_name, 0, "%s.lck", info->path); if (!strcmp(file_mode, "r")) { @@ -924,7 +930,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (error || hptr->open(info, &error TSRMLS_CC) != SUCCESS) { dba_close(info TSRMLS_CC); - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Driver initialization failed for handler: %s%s%s", hptr->name, error?": ":"", error?error:""); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "Driver initialization failed for handler: %s%s%s", hptr->name, error?": ":"", error?error:""); FREENOW; RETURN_FALSE; } @@ -934,13 +940,13 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, int persistent) info->argv = NULL; if (persistent) { - zend_rsrc_list_entry new_le; + zend_resource new_le; - Z_TYPE(new_le) = le_pdb; + new_le.type = le_pdb; new_le.ptr = info; - if (zend_hash_update(&EG(persistent_list), key, keylen+1, &new_le, sizeof(zend_rsrc_list_entry), NULL) == FAILURE) { + if (zend_hash_str_update_mem(&EG(persistent_list), key, keylen, &new_le, sizeof(zend_resource)) == NULL) { dba_close(info TSRMLS_CC); - php_error_docref2(NULL TSRMLS_CC, Z_STRVAL_PP(args[0]), Z_STRVAL_PP(args[1]), E_WARNING, "Could not register persistent resource"); + php_error_docref2(NULL TSRMLS_CC, Z_STRVAL(args[0]), Z_STRVAL(args[1]), E_WARNING, "Could not register persistent resource"); FREENOW; RETURN_FALSE; } @@ -979,9 +985,9 @@ PHP_FUNCTION(dba_close) return; } - DBA_FETCH_RESOURCE(info, &id); + DBA_FETCH_RESOURCE(info, id); - zend_list_delete(Z_RESVAL_P(id)); + zend_list_close(Z_RES_P(id)); } /* }}} */ @@ -1034,7 +1040,9 @@ PHP_FUNCTION(dba_fetch) } if((val = info->hnd->fetch(info, key_str, key_len, skip, &len TSRMLS_CC)) != NULL) { DBA_ID_DONE; - RETURN_STRINGL(val, len, 0); + RETVAL_STRINGL(val, len); + efree(val); + return; } DBA_ID_DONE; RETURN_FALSE; @@ -1053,7 +1061,7 @@ PHP_FUNCTION(dba_key_split) WRONG_PARAM_COUNT; } if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z", &zkey) == SUCCESS) { - if (Z_TYPE_P(zkey) == IS_NULL || (Z_TYPE_P(zkey) == IS_BOOL && !Z_LVAL_P(zkey))) { + if (Z_TYPE_P(zkey) == IS_NULL || (Z_TYPE_P(zkey) == IS_FALSE)) { RETURN_BOOL(0); } } @@ -1084,12 +1092,15 @@ PHP_FUNCTION(dba_firstkey) return; } - DBA_FETCH_RESOURCE(info, &id); + DBA_FETCH_RESOURCE(info, id); fkey = info->hnd->firstkey(info, &len TSRMLS_CC); - if (fkey) - RETURN_STRINGL(fkey, len, 0); + if (fkey) { + RETVAL_STRINGL(fkey, len); + efree(fkey); + return; + } RETURN_FALSE; } @@ -1108,12 +1119,15 @@ PHP_FUNCTION(dba_nextkey) return; } - DBA_FETCH_RESOURCE(info, &id); + DBA_FETCH_RESOURCE(info, id); nkey = info->hnd->nextkey(info, &len TSRMLS_CC); - if (nkey) - RETURN_STRINGL(nkey, len, 0); + if (nkey) { + RETVAL_STRINGL(nkey, len); + efree(nkey); + return; + } RETURN_FALSE; } @@ -1167,7 +1181,7 @@ PHP_FUNCTION(dba_optimize) return; } - DBA_FETCH_RESOURCE(info, &id); + DBA_FETCH_RESOURCE(info, id); DBA_WRITE_CHECK; @@ -1190,7 +1204,7 @@ PHP_FUNCTION(dba_sync) return; } - DBA_FETCH_RESOURCE(info, &id); + DBA_FETCH_RESOURCE(info, id); if (info->hnd->sync(info TSRMLS_CC) == SUCCESS) { RETURN_TRUE; @@ -1231,7 +1245,7 @@ PHP_FUNCTION(dba_handlers) PHP_FUNCTION(dba_list) { ulong numitems, i; - zend_rsrc_list_entry *le; + zend_resource *le; dba_info *info; if (zend_parse_parameters_none() == FAILURE) { @@ -1242,10 +1256,10 @@ PHP_FUNCTION(dba_list) numitems = zend_hash_next_free_element(&EG(regular_list)); for (i=1; itype == le_db || le->type == le_pdb) { info = (dba_info *)(le->ptr); add_index_string(return_value, i, info->path); } diff --git a/ext/dba/dba_db1.c b/ext/dba/dba_db1.c index a8221b9562..8ee5d95f22 100644 --- a/ext/dba/dba_db1.c +++ b/ext/dba/dba_db1.c @@ -51,8 +51,8 @@ DBA_OPEN_FUNC(db1) int filemode = 0644; if (info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = Z_LVAL_PP(info->argv[0]); + convert_to_long_ex(&info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } gmode = 0; diff --git a/ext/dba/dba_db2.c b/ext/dba/dba_db2.c index b6879ca730..60aa37f93a 100644 --- a/ext/dba/dba_db2.c +++ b/ext/dba/dba_db2.c @@ -72,8 +72,8 @@ DBA_OPEN_FUNC(db2) } if (info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = Z_LVAL_PP(info->argv[0]); + convert_to_long_ex(&info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } if (db_open(info->path, type, gmode, filemode, NULL, NULL, &dbp)) { diff --git a/ext/dba/dba_db3.c b/ext/dba/dba_db3.c index e248be8e28..95a1e51fe0 100644 --- a/ext/dba/dba_db3.c +++ b/ext/dba/dba_db3.c @@ -81,8 +81,8 @@ DBA_OPEN_FUNC(db3) } if (info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = Z_LVAL_PP(info->argv[0]); + convert_to_long_ex(&info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } #ifdef DB_FCNTL_LOCKING diff --git a/ext/dba/dba_db4.c b/ext/dba/dba_db4.c index 7f9dfed7ab..94a6c95e81 100644 --- a/ext/dba/dba_db4.c +++ b/ext/dba/dba_db4.c @@ -118,8 +118,8 @@ DBA_OPEN_FUNC(db4) } if (info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = Z_LVAL_PP(info->argv[0]); + convert_to_long_ex(&info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } if ((err=db_create(&dbp, NULL, 0)) == 0) { diff --git a/ext/dba/dba_dbm.c b/ext/dba/dba_dbm.c index c18c04f77e..f65a79bcc7 100644 --- a/ext/dba/dba_dbm.c +++ b/ext/dba/dba_dbm.c @@ -60,8 +60,8 @@ DBA_OPEN_FUNC(dbm) int filemode = 0644; if(info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = Z_LVAL_PP(info->argv[0]); + convert_to_long_ex(&info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } if(info->mode == DBA_TRUNC) { diff --git a/ext/dba/dba_gdbm.c b/ext/dba/dba_gdbm.c index 345687fcf7..d2c4a2f367 100644 --- a/ext/dba/dba_gdbm.c +++ b/ext/dba/dba_gdbm.c @@ -54,8 +54,8 @@ DBA_OPEN_FUNC(gdbm) return FAILURE; /* not possible */ if(info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = Z_LVAL_PP(info->argv[0]); + convert_to_long_ex(&info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } dbf = gdbm_open(info->path, 0, gmode, filemode, NULL); diff --git a/ext/dba/dba_ndbm.c b/ext/dba/dba_ndbm.c index bad6385708..417446759c 100644 --- a/ext/dba/dba_ndbm.c +++ b/ext/dba/dba_ndbm.c @@ -59,8 +59,8 @@ DBA_OPEN_FUNC(ndbm) } if(info->argc > 0) { - convert_to_long_ex(info->argv[0]); - filemode = Z_LVAL_PP(info->argv[0]); + convert_to_long_ex(&info->argv[0]); + filemode = Z_LVAL(info->argv[0]); } dbf = dbm_open(info->path, gmode, filemode); diff --git a/ext/dba/php_dba.h b/ext/dba/php_dba.h index 6b21b06ee6..d4d4c62c4a 100644 --- a/ext/dba/php_dba.h +++ b/ext/dba/php_dba.h @@ -46,7 +46,7 @@ typedef struct dba_info { int fd; /* arg[cv] are only available when the dba_open handler is called! */ int argc; - zval ***argv; + zval *argv; /* private */ int flags; /* whether and how dba did locking and other flags*/ struct dba_handler *hnd;