helly Fri Nov 22 10:53:01 2002 EDT Modified files: (Branch: PHP_4_3) /php4/ext/dba dba.c /php4/ext/dba/tests dba008.phpt Log: MFH Index: php4/ext/dba/dba.c diff -u php4/ext/dba/dba.c:1.61.2.2 php4/ext/dba/dba.c:1.61.2.3 --- php4/ext/dba/dba.c:1.61.2.2 Thu Nov 14 16:52:21 2002 +++ php4/ext/dba/dba.c Fri Nov 22 10:53:00 2002 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: dba.c,v 1.61.2.2 2002/11/14 21:52:21 helly Exp $ */ +/* $Id: dba.c,v 1.61.2.3 2002/11/22 15:53:00 helly Exp $ */ #ifdef HAVE_CONFIG_H #include "config.h" @@ -285,6 +285,8 @@ { 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 @@ 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; } /* }}} */ Index: php4/ext/dba/tests/dba008.phpt diff -u php4/ext/dba/tests/dba008.phpt:1.1.2.2 php4/ext/dba/tests/dba008.phpt:1.1.2.3 --- php4/ext/dba/tests/dba008.phpt:1.1.2.2 Fri Nov 15 11:39:36 2002 +++ php4/ext/dba/tests/dba008.phpt Fri Nov 22 10:53:01 2002 @@ -10,11 +10,15 @@ 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 @@ database handler: %s string(1) """ string(2) "\"" +string(2) "\"" +string(1) """
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php