php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login

Patch php-sqlite3-exec-bound-param-free-fix for SQLite related Bug #71049

Patch version 2015-12-07 12:34 UTC

Return to Bug #71049 | Download this patch
Patch Revisions:

Developer: sustmidown@centrum.cz

diff --git a/ext/sqlite3/sqlite3.c b/ext/sqlite3/sqlite3.c
index 4e3cc28..0339332 100644
--- a/ext/sqlite3/sqlite3.c
+++ b/ext/sqlite3/sqlite3.c
@@ -1542,7 +1542,9 @@ PHP_METHOD(sqlite3stmt, execute)
 
 					if (buffer) {
 						sqlite3_bind_blob(stmt_obj->stmt, param->param_number, ZSTR_VAL(buffer), ZSTR_LEN(buffer), SQLITE_TRANSIENT);
-						zend_string_release(buffer);
+						if (Z_TYPE_P(parameter) == IS_RESOURCE) {
+							zend_string_release(buffer);
+						}
 					} else {
 						sqlite3_bind_null(stmt_obj->stmt, param->param_number);
 					}
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 15 07:05:44 2022 UTC