1
0
mirror of https://github.com/php/php-src.git synced 2026-04-29 11:13:36 +02:00
This commit is contained in:
Marcus Boerger
2002-11-22 15:53:01 +00:00
parent 14d6306385
commit 435d875a02
2 changed files with 22 additions and 3 deletions
+15 -2
View File
@@ -285,6 +285,8 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
{
DBA_ID_PARS;
zval **val, **key;
char *v;
int len;
if(ac != 3 || zend_get_parameters_ex(ac, &key, &val, &id) != SUCCESS) {
WRONG_PARAM_COUNT;
@@ -295,8 +297,19 @@ static void php_dba_update(INTERNAL_FUNCTION_PARAMETERS, int mode)
DBA_WRITE_CHECK;
if(info->hnd->update(info, VALLEN(key), VALLEN(val), mode TSRMLS_CC) == SUCCESS)
RETURN_TRUE;
if (PG(magic_quotes_runtime)) {
len = Z_STRLEN_PP(val);
v = estrndup(Z_STRVAL_PP(val), len);
php_stripslashes(v, &len TSRMLS_CC);
if(info->hnd->update(info, VALLEN(key), v, len, mode TSRMLS_CC) == SUCCESS) {
efree(v);
RETURN_TRUE;
}
efree(v);
} else {
if(info->hnd->update(info, VALLEN(key), VALLEN(val), mode TSRMLS_CC) == SUCCESS)
RETURN_TRUE;
}
RETURN_FALSE;
}
/* }}} */
+7 -1
View File
@@ -10,11 +10,15 @@ DBA magic_quotes_runtime Test
require_once('test.inc');
echo "database handler: $handler\n";
if (($db_file=dba_open($db_file, "n", $handler))!==FALSE) {
dba_insert("key1", '"', $db_file);
ini_set('magic_quotes_runtime', 0);
dba_insert("key1", '"', $db_file);
var_dump(dba_fetch("key1", $db_file));
ini_set('magic_quotes_runtime', 1);
var_dump(dba_fetch("key1", $db_file));
dba_replace("key1", '\"', $db_file);
var_dump(dba_fetch("key1", $db_file));
ini_set('magic_quotes_runtime', 0);
var_dump(dba_fetch("key1", $db_file));
dba_close($db_file);
} else {
echo "Error creating database\n";
@@ -24,3 +28,5 @@ DBA magic_quotes_runtime Test
database handler: %s
string(1) """
string(2) "\""
string(2) "\""
string(1) """