com php-src: Fixed Bug #71049 (SQLite3Stmt::execute() releases bound parameter instead of internal buffer): NEWS ext/sqlite3/sqlite3.c
ext/sqlite3/tests/bug71049.phpt

From: Date: Mon, 07 Dec 2015 15:43:09 +0000
Subject: com php-src: Fixed Bug #71049 (SQLite3Stmt::execute() releases bound parameter instead of internal buffer): NEWS ext/sqlite3/sqlite3.c
ext/sqlite3/tests/bug71049.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-90108@lists.php.net to get a copy of this message
Commit: 250430acdc230ae9a894b8939653aad6fad537ce Author: Xinchen Hui <laruence@gmail.com> Mon, 7 Dec 2015 07:43:09 -0800 Parents: 6ac12f13379f3fc19f07abb9d1055274e5f98838 Branches: PHP-7.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=250430acdc230ae9a894b8939653aad6fad537ce Log: Fixed Bug #71049 (SQLite3Stmt::execute() releases bound parameter instead of internal buffer) Bugs: https://bugs.php.net/71049 Changed paths: M NEWS M ext/sqlite3/sqlite3.c A ext/sqlite3/tests/bug71049.phpt Diff: diff --git a/NEWS b/NEWS index 0c7d88a..7871ffc 100644 --- a/NEWS +++ b/NEWS @@ -67,6 +67,10 @@ PHP NEWS - SPL: . Fixed bug #71028 (Undefined index with ArrayIterator). (Laruence) +- SQLite3: + . Fixed bug #71049 (SQLite3Stmt::execute() releases bound parameter instead + of internal buffer). (Laruence) + - Standard: . Fixed bug #70999 (php_random_bytes: called object is not a function). (Scott) diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c index 4e3cc28..7559343 100644 --- a/ext/sqlite3/sqlite3.c +++ b/ext/sqlite3/sqlite3.c @@ -1536,8 +1536,7 @@ PHP_METHOD(sqlite3stmt, execute) } buffer = php_stream_copy_to_mem(stream, PHP_STREAM_COPY_ALL, 0); } else { - convert_to_string(parameter); - buffer = Z_STR_P(parameter); + buffer = zval_get_string(parameter); } if (buffer) { diff --git a/ext/sqlite3/tests/bug71049.phpt b/ext/sqlite3/tests/bug71049.phpt new file mode 100644 index 0000000..5c2843f --- /dev/null +++ b/ext/sqlite3/tests/bug71049.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #71049 (SQLite3Stmt::execute() releases bound parameter instead of internal buffer) +--SKIPIF-- +<?php +if (!extension_loaded('sqlite3')) die('skip'); ?> +--FILE-- +<?php + +require(__DIR__ . '/new_db.inc'); + +$db->exec('CREATE TABLE test (age INTEGER, id STRING)'); + +$stmt = $db->prepare("SELECT * FROM test WHERE id = ? ORDER BY id ASC"); +$foo = "alive" . chr(33); +$stmt->bindParam(1, $foo, SQLITE3_BLOB); +$results = $stmt->execute(); +var_dump($foo); +$db->close(); +?> +--EXPECT-- +string(6) "alive!"

« previous php.cvs (#90108) next »