xref: /php-src/ext/pdo_mysql/tests/bug70862.phpt (revision 4bb75d56)
1--TEST--
2MySQL Prepared Statements and BLOBs
3--EXTENSIONS--
4pdo_mysql
5--SKIPIF--
6<?php
7require_once __DIR__ . '/inc/mysql_pdo_test.inc';
8MySQLPDOTest::skip();
9?>
10--FILE--
11<?php
12    require_once __DIR__ . '/inc/mysql_pdo_test.inc';
13    $db = MySQLPDOTest::factory();
14
15    $db->exec(sprintf('CREATE TABLE test_70862(id INT, label BLOB)'));
16
17    $db->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
18    $db->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
19
20    class HelloWrapper {
21        public $context;
22        public function stream_open() { return true; }
23        public function stream_eof() { return true; }
24        public function stream_read() { return NULL; }
25        public function stream_stat() { return array(); }
26    }
27    stream_wrapper_register("hello", "HelloWrapper");
28
29    $f = fopen("hello://there", "r");
30
31    $stmt = $db->prepare('INSERT INTO test_70862(id, label) VALUES (1, :para)');
32    $stmt->bindParam(":para", $f, PDO::PARAM_LOB);
33    $stmt->execute();
34
35    var_dump($f);
36
37    print "done!";
38?>
39--CLEAN--
40<?php
41require_once __DIR__ . '/inc/mysql_pdo_test.inc';
42$db = MySQLPDOTest::factory();
43$db->exec('DROP TABLE IF EXISTS test_70862');
44?>
45--EXPECT--
46string(0) ""
47done!
48