felipe Fri Nov 28 15:37:02 2008 UTC
Added files: (Branch: PHP_5_3)
/php-src/ext/sqlite3/tests sqlite3_29_createfunction.phpt
Modified files:
/php-src/ext/sqlite3 sqlite3.c
Log:
- MFH: Fixed memory leaks in createFunction and createAggregate methods
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/sqlite3.c?r1=1.1.2.20&r2=1.1.2.21&diff_format=u
Index: php-src/ext/sqlite3/sqlite3.c
diff -u php-src/ext/sqlite3/sqlite3.c:1.1.2.20
php-src/ext/sqlite3/sqlite3.c:1.1.2.21
--- php-src/ext/sqlite3/sqlite3.c:1.1.2.20 Thu Nov 27 19:01:23 2008
+++ php-src/ext/sqlite3/sqlite3.c Fri Nov 28 15:37:02 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sqlite3.c,v 1.1.2.20 2008/11/27 19:01:23 dmitry Exp $ */
+/* $Id: sqlite3.c,v 1.1.2.21 2008/11/28 15:37:02 felipe Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -791,6 +791,7 @@
MAKE_STD_ZVAL(func->func);
*(func->func) = *callback_func;
zval_copy_ctor(func->func);
+ INIT_PZVAL(func->func);
func->argc = sql_func_num_args;
func->next = db_obj->funcs;
@@ -849,10 +850,12 @@
MAKE_STD_ZVAL(func->step);
*(func->step) = *step_callback;
zval_copy_ctor(func->step);
+ INIT_PZVAL(func->step);
MAKE_STD_ZVAL(func->fini);
*(func->fini) = *fini_callback;
zval_copy_ctor(func->fini);
+ INIT_PZVAL(func->fini);
func->argc = sql_func_num_args;
func->next = db_obj->funcs;
http://cvs.php.net/viewvc.cgi/php-src/ext/sqlite3/tests/sqlite3_29_createfunction.phpt?view=markup&rev=1.1
Index: php-src/ext/sqlite3/tests/sqlite3_29_createfunction.phpt
+++ php-src/ext/sqlite3/tests/sqlite3_29_createfunction.phpt
--TEST--
SQLite3::createFunction - Basic test
--SKIPIF--
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
--FILE--
<?php
require_once(dirname(__FILE__) . '/new_db.inc');
$func = 'strtoupper';
var_dump($db->createfunction($func, $func));
var_dump($db->querySingle('SELECT strtoupper("test")'));
$func2 = 'strtolower';
var_dump($db->createfunction($func2, $func2));
var_dump($db->querySingle('SELECT strtolower("TEST")'));
var_dump($db->createfunction($func, $func2));
var_dump($db->querySingle('SELECT strtoupper("tEst")'));
?>
--EXPECTF--
bool(true)
%string|unicode%(4) "TEST"
bool(true)
%string|unicode%(4) "test"
bool(true)
%string|unicode%(4) "test"
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php