1--TEST-- 2PDO MySQL PECL Bug #5802 (bindParam/bindValue retain the is_null flag) 3--SKIPIF-- 4<?php # vim:ft=php: 5if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded'); 6require dirname(__FILE__) . '/config.inc'; 7require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; 8PDOTest::skip(); 9?> 10--FILE-- 11<?php 12require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc'; 13$db = PDOTest::test_factory(dirname(__FILE__). '/common.phpt'); 14 15$db->exec('create table test ( bar char(3) NULL )'); 16$stmt = $db->prepare('insert into test (bar) values(:bar)') or var_dump($db->errorInfo()); 17 18$bar = 'foo'; 19$stmt->bindParam(':bar', $bar); 20$stmt->execute() or var_dump($stmt->errorInfo()); 21 22$bar = null; 23$stmt->bindParam(':bar', $bar); 24$stmt->execute() or var_dump($stmt->errorInfo()); 25 26$bar = 'qaz'; 27$stmt->bindParam(':bar', $bar); 28$stmt->execute() or var_dump($stmt->errorInfo()); 29 30$stmt = $db->prepare('select * from test') or var_dump($db->errorInfo()); 31 32if($stmt) $stmt->execute(); 33if($stmt) var_dump($stmt->fetchAll(PDO::FETCH_ASSOC)); 34 35print "done!"; 36?> 37--CLEAN-- 38<?php 39require dirname(__FILE__) . '/mysql_pdo_test.inc'; 40$db = MySQLPDOTest::factory(); 41$db->exec('DROP TABLE IF EXISTS test'); 42?> 43--EXPECTF-- 44array(3) { 45 [0]=> 46 array(1) { 47 [%u|b%"bar"]=> 48 %unicode|string%(3) "foo" 49 } 50 [1]=> 51 array(1) { 52 [%u|b%"bar"]=> 53 NULL 54 } 55 [2]=> 56 array(1) { 57 [%u|b%"bar"]=> 58 %unicode|string%(3) "qaz" 59 } 60} 61done! 62