|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-12-05 10:57 UTC] sjon at hortensius dot net
[2020-02-24 07:50 UTC] cmb@php.net
-Package: PDO SQLite
+Package: PDO related
[2020-02-24 07:50 UTC] cmb@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 23:00:01 2025 UTC |
Description: ------------ If passing a stream as a parameter of PDOStatement::bindParam it is transformed to a string which contains the stream contents. For example this prevents reusing the stream handle to close it properly or to truncate or change the file contents. Test script: --------------- <?php $pdo = new PDO('sqlite::memory:'); $pdo->exec('CREATE TABLE test (a INTEGER, b BLOB);'); $fp = tmpfile(); fwrite($fp, 'Random stuff!'); fseek($fp, 0); $stmt = $pdo->prepare('INSERT INTO test VALUES (?, ?);'); $stmt->bindValue(1, 42); $stmt->bindParam(2, $fp, PDO::PARAM_LOB); $stmt->execute(); var_dump(gettype($fp)); Expected result: ---------------- resource Actual result: -------------- string