xref: /php-src/ext/pdo_sqlite/tests/bug70862.phpt (revision 417f3fdb)
1--TEST--
2PDO_sqlite: Testing sqliteCreateCollation()
3--EXTENSIONS--
4pdo_sqlite
5--FILE--
6<?php
7
8$db = new PDO('sqlite::memory:');
9$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
10
11$db->exec('CREATE TABLE test_70862(field BLOB)');
12
13$db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
14$db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
15
16class HelloWrapper {
17    public $context;
18    public function stream_open() { return true; }
19    public function stream_eof() { return true; }
20    public function stream_read() { return NULL; }
21    public function stream_stat() { return array(); }
22}
23stream_wrapper_register("hello", "HelloWrapper");
24
25$f = fopen("hello://there", "r");
26
27$stmt = $db->prepare('INSERT INTO test_70862(field) VALUES (:para)');
28$stmt->bindParam(":para", $f, PDO::PARAM_LOB);
29$stmt->execute();
30
31var_dump($f);
32
33?>
34+++DONE+++
35--EXPECT--
36string(0) ""
37+++DONE+++
38