mirror of
https://github.com/php/php-src.git
synced 2026-03-31 04:32:19 +02:00
This patch adds missing newlines, trims multiple redundant final newlines into a single one, and trims redundant leading newlines in all *.phpt sections. According to POSIX, a line is a sequence of zero or more non-' <newline>' characters plus a terminating '<newline>' character. [1] Files should normally have at least one final newline character. C89 [2] and later standards [3] mention a final newline: "A source file that is not empty shall end in a new-line character, which shall not be immediately preceded by a backslash character." Although it is not mandatory for all files to have a final newline fixed, a more consistent and homogeneous approach brings less of commit differences issues and a better development experience in certain text editors and IDEs. [1] http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206 [2] https://port70.net/~nsz/c/c89/c89-draft.html#2.1.1.2 [3] https://port70.net/~nsz/c/c99/n1256.html#5.1.1.2
99 lines
2.3 KiB
PHP
99 lines
2.3 KiB
PHP
--TEST--
|
|
PDO PgSQL Bug #38671 (PDO#getAttribute() cannot be called with platform-specific attribute names)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
|
|
require dirname(__FILE__) . '/config.inc';
|
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
|
PDOTest::skip();
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
|
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
|
$pdo = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
|
$pdo->setAttribute (\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
|
|
|
|
$attrs = array(
|
|
// Extensive test: default value and set+get values
|
|
PDO::ATTR_EMULATE_PREPARES => array(null, true, false),
|
|
PDO::PGSQL_ATTR_DISABLE_PREPARES => array(null, true, false),
|
|
|
|
// Just test the default
|
|
PDO::ATTR_AUTOCOMMIT => array(null),
|
|
PDO::ATTR_PREFETCH => array(null),
|
|
PDO::ATTR_TIMEOUT => array(null),
|
|
PDO::ATTR_ERRMODE => array(null),
|
|
PDO::ATTR_SERVER_VERSION => array(null),
|
|
PDO::ATTR_CLIENT_VERSION => array(null),
|
|
PDO::ATTR_SERVER_INFO => array(null),
|
|
PDO::ATTR_CONNECTION_STATUS => array(null),
|
|
PDO::ATTR_CASE => array(null),
|
|
PDO::ATTR_CURSOR_NAME => array(null),
|
|
PDO::ATTR_CURSOR => array(null),
|
|
PDO::ATTR_ORACLE_NULLS => array(null),
|
|
PDO::ATTR_PERSISTENT => array(null),
|
|
PDO::ATTR_STATEMENT_CLASS => array(null),
|
|
PDO::ATTR_FETCH_TABLE_NAMES => array(null),
|
|
PDO::ATTR_FETCH_CATALOG_NAMES => array(null),
|
|
PDO::ATTR_DRIVER_NAME => array(null),
|
|
PDO::ATTR_STRINGIFY_FETCHES => array(null),
|
|
PDO::ATTR_MAX_COLUMN_LEN => array(null),
|
|
PDO::ATTR_DEFAULT_FETCH_MODE => array(null),
|
|
);
|
|
|
|
foreach ($attrs as $a => $vals) {
|
|
foreach ($vals as $v) {
|
|
try {
|
|
if (!isset($v)) {
|
|
var_dump($pdo->getAttribute($a));
|
|
} else {
|
|
$pdo->setAttribute($a, $v);
|
|
if ($pdo->getAttribute($a) === $v) {
|
|
echo "OK\n";
|
|
} else {
|
|
throw new \Exception('KO');
|
|
}
|
|
}
|
|
} catch (\Exception $e) {
|
|
if ($e->getCode() == 'IM001') {
|
|
echo "ERR\n";
|
|
} else {
|
|
echo "ERR {$e->getMessage()}\n";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
?>
|
|
--EXPECTF--
|
|
bool(false)
|
|
OK
|
|
OK
|
|
bool(false)
|
|
OK
|
|
OK
|
|
ERR
|
|
ERR
|
|
ERR
|
|
int(2)
|
|
string(%d) "%s"
|
|
string(%d) "%s"
|
|
string(%d) "%s"
|
|
string(31) "%s"
|
|
int(2)
|
|
ERR
|
|
ERR
|
|
int(0)
|
|
bool(false)
|
|
array(1) {
|
|
[0]=>
|
|
string(12) "PDOStatement"
|
|
}
|
|
ERR
|
|
ERR
|
|
string(5) "pgsql"
|
|
ERR
|
|
ERR
|
|
int(4)
|