summaryrefslogtreecommitdiff
path: root/ext/pdo/tests/bug_60665.phpt
blob: efc43e4b501ee5327df3803f71509658eb7c191b (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
--TEST--
PDO Common: Bug #60665 (call to empty() on NULL result using PDO::FETCH_LAZY returns false)
--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_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
switch ($db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
    case 'oci': $from = 'from dual'; break;
    case 'firebird': $from = 'from rdb$database'; break;
    default: $from = ''; break;
}
$statement = $db->prepare("SELECT NULL AS null_value, 0 AS zero, 1 AS one $from");
$statement->execute();
$row = $statement->fetch(PDO::FETCH_LAZY);
var_dump(
    empty($row->null_value),
    empty($row->zero),
    !empty($row->one),
    empty($row->missing),
    !isset($row->null_value),
    isset($row->zero),
    isset($row->one),
    !isset($row->missing)
);
?>
--EXPECT--
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)
bool(true)