--- embedaddon/php/ext/dba/dba.c 2012/02/21 23:47:54 1.1 +++ embedaddon/php/ext/dba/dba.c 2013/10/14 08:02:11 1.1.1.4 @@ -2,7 +2,7 @@ +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ - | Copyright (c) 1997-2012 The PHP Group | + | Copyright (c) 1997-2013 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba.c,v 1.1 2012/02/21 23:47:54 misho Exp $ */ +/* $Id: dba.c,v 1.1.1.4 2013/10/14 08:02:11 misho Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -50,6 +50,7 @@ #include "php_flatfile.h" #include "php_inifile.h" #include "php_qdbm.h" +#include "php_tcadb.h" /* {{{ arginfo */ ZEND_BEGIN_ARG_INFO_EX(arginfo_dba_popen, 0, 0, 2) @@ -337,6 +338,9 @@ static dba_handler handler[] = { #if DBA_QDBM DBA_HND(qdbm, DBA_LOCK_EXT) #endif +#if DBA_TCADB + DBA_HND(tcadb, DBA_LOCK_ALL) +#endif { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } }; @@ -358,6 +362,8 @@ static dba_handler handler[] = { #define DBA_DEFAULT "dbm" #elif DBA_QDBM #define DBA_DEFAULT "qdbm" +#elif DBA_TCADB +#define DBA_DEFAULT "tcadb" #else #define DBA_DEFAULT "" #endif @@ -532,7 +538,6 @@ PHP_MINFO_FUNCTION(dba) */ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode) { - char *v; int val_len; zval *id; dba_info *info = NULL; @@ -554,20 +559,9 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETER DBA_WRITE_CHECK; - if (PG(magic_quotes_runtime)) { - v = estrndup(val, val_len); - php_stripslashes(v, &val_len TSRMLS_CC); - if (info->hnd->update(info, key_str, key_len, v, val_len, mode TSRMLS_CC) == SUCCESS) { - efree(v); - DBA_ID_DONE; - RETURN_TRUE; - } - efree(v); - } else { - if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) { - DBA_ID_DONE; - RETURN_TRUE; - } + if (info->hnd->update(info, key_str, key_len, val, val_len, mode TSRMLS_CC) == SUCCESS) { + DBA_ID_DONE; + RETURN_TRUE; } DBA_ID_DONE; @@ -832,7 +826,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, /* when in read only mode try to use existing .lck file first */ /* do not log errors for .lck file while in read ony mode on .lck file */ lock_file_mode = "rb"; - info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, &opened_path); + info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|IGNORE_PATH|persistent_flag, &opened_path); } if (!info->lock.fp) { /* when not in read mode or failed to open .lck file read only. now try again in create(write) mode and log errors */ @@ -847,7 +841,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, } } if (!info->lock.fp) { - info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, &opened_path); + info->lock.fp = php_stream_open_wrapper(lock_name, lock_file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|persistent_flag, &opened_path); if (info->lock.fp) { if (lock_dbf) { /* replace the path info with the real path of the opened file */ @@ -885,7 +879,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, if (info->lock.fp && lock_dbf) { info->fp = info->lock.fp; /* use the same stream for locking and database access */ } else { - info->fp = php_stream_open_wrapper(info->path, file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|ENFORCE_SAFE_MODE|persistent_flag, NULL); + info->fp = php_stream_open_wrapper(info->path, file_mode, STREAM_MUST_SEEK|REPORT_ERRORS|IGNORE_PATH|persistent_flag, NULL); } if (!info->fp) { dba_close(info TSRMLS_CC); @@ -894,7 +888,7 @@ static void php_dba_open(INTERNAL_FUNCTION_PARAMETERS, RETURN_FALSE; } if (hptr->flags & (DBA_NO_APPEND|DBA_CAST_AS_FD)) { - /* Needed becasue some systems do not allow to write to the original + /* Needed because some systems do not allow to write to the original * file contents with O_APPEND being set. */ if (SUCCESS != php_stream_cast(info->fp, PHP_STREAM_AS_FD, (void*)&info->fd, 1)) { @@ -1023,9 +1017,6 @@ PHP_FUNCTION(dba_fetch) skip = 0; } if((val = info->hnd->fetch(info, key_str, key_len, skip, &len TSRMLS_CC)) != NULL) { - if (val && PG(magic_quotes_runtime)) { - val = php_addslashes(val, len, &len, 1 TSRMLS_CC); - } DBA_ID_DONE; RETURN_STRINGL(val, len, 0); }