mirror of
https://github.com/php/php-src.git
synced 2024-09-22 10:27:25 +00:00
7485978339
This is an automated migration of most SKIPIF extension_loaded checks.
47 lines
1.3 KiB
PHP
47 lines
1.3 KiB
PHP
--TEST--
|
|
PDO Common: assert that bindParam does not modify parameter
|
|
--EXTENSIONS--
|
|
pdo
|
|
--SKIPIF--
|
|
<?php
|
|
$dir = getenv('REDIR_TEST_DIR');
|
|
if (false == $dir) die('skip no driver');
|
|
require_once $dir . 'pdo_test.inc';
|
|
PDOTest::skip();
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/');
|
|
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
|
|
$db = PDOTest::factory();
|
|
|
|
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
|
|
case 'dblib':
|
|
// environment settings can influence how the table is created if specifics are missing
|
|
// https://msdn.microsoft.com/en-us/library/ms174979.aspx#Nullability Rules Within a Table Definition
|
|
$sql = 'create table test (id int, name varchar(10) null)';
|
|
break;
|
|
default:
|
|
$sql = 'create table test (id int, name varchar(10))';
|
|
break;
|
|
}
|
|
$db->exec($sql);
|
|
|
|
$stmt = $db->prepare('insert into test (id, name) values(0, :name)');
|
|
$name = NULL;
|
|
$before_bind = $name;
|
|
$stmt->bindParam(':name', $name, PDO::PARAM_NULL);
|
|
if ($name !== $before_bind) {
|
|
echo "bind: fail\n";
|
|
} else {
|
|
echo "bind: success\n";
|
|
}
|
|
var_dump($stmt->execute());
|
|
var_dump($db->query('select name from test where id=0')->fetchColumn());
|
|
|
|
?>
|
|
--EXPECT--
|
|
bind: success
|
|
bool(true)
|
|
NULL
|