blob: abf9ac7275ab07795230666e0b0282704717a781 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
--TEST--
PDO Common: Bug #44173 (PDO->query() parameter parsing/checking needs an update)
--SKIPIF--
<?php
if (!extension_loaded('pdo')) die('skip');
$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 getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
$db->exec("CREATE TABLE test (x int)");
$db->exec("INSERT INTO test VALUES (1)");
// Bug entry [1]
$stmt = $db->query();
var_dump($stmt);
// Bug entry [2] -- 1 is PDO::FETCH_LAZY
$stmt = $db->query("SELECT * FROM test", PDO::FETCH_LAZY, 0, 0);
var_dump($stmt);
// Bug entry [3]
$stmt = $db->query("SELECT * FROM test", 'abc');
var_dump($stmt);
// Bug entry [4]
$stmt = $db->query("SELECT * FROM test", PDO::FETCH_CLASS, 0, 0, 0);
var_dump($stmt);
// Bug entry [5]
$stmt = $db->query("SELECT * FROM test", PDO::FETCH_INTO);
var_dump($stmt);
// Bug entry [6]
$stmt = $db->query("SELECT * FROM test", PDO::FETCH_COLUMN);
var_dump($stmt);
// Bug entry [7]
$stmt = $db->query("SELECT * FROM test", PDO::FETCH_CLASS);
var_dump($stmt);
?>
--EXPECTF--
Warning: PDO::query() expects at least 1 parameter, 0 given in %s
bool(false)
Warning: PDO::query(): SQLSTATE[HY000]: General error: fetch mode doesn't allow any extra arguments in %s
bool(false)
Warning: PDO::query(): SQLSTATE[HY000]: General error: mode must be an integer in %s
bool(false)
Warning: PDO::query(): SQLSTATE[HY000]: General error: too many arguments in %s
bool(false)
Warning: PDO::query(): SQLSTATE[HY000]: General error: fetch mode requires the object parameter in %s
bool(false)
Warning: PDO::query(): SQLSTATE[HY000]: General error: fetch mode requires the colno argument in %s
bool(false)
Warning: PDO::query(): SQLSTATE[HY000]: General error: fetch mode requires the classname argument in %s
bool(false)
|