1--TEST-- 2PDO Common: assert that bindParam does not modify parameter 3--SKIPIF-- 4<?php # vim:ft=php 5if (!extension_loaded('pdo')) die('skip'); 6$dir = getenv('REDIR_TEST_DIR'); 7if (false == $dir) die('skip no driver'); 8require_once $dir . 'pdo_test.inc'; 9PDOTest::skip(); 10?> 11--FILE-- 12<?php 13if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); 14require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 15$db = PDOTest::factory(); 16 17$db->exec('create table test (id int, name varchar(10))'); 18 19$stmt = $db->prepare('insert into test (id, name) values(0, :name)'); 20$name = NULL; 21$before_bind = $name; 22$stmt->bindParam(':name', $name); 23if ($name !== $before_bind) { 24 echo "bind: fail\n"; 25} else { 26 echo "bind: success\n"; 27} 28var_dump($stmt->execute()); 29var_dump($db->query('select name from test where id=0')->fetchColumn()); 30 31?> 32--EXPECT-- 33bind: success 34bool(true) 35NULL 36