-
Notifications
You must be signed in to change notification settings - Fork 8k
Expand file tree
/
Copy pathpg_fetch_object_with_abstract_class.phpt
More file actions
59 lines (50 loc) · 1.22 KB
/
pg_fetch_object_with_abstract_class.phpt
File metadata and controls
59 lines (50 loc) · 1.22 KB
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
--TEST--
pg_fetch_object() with abstract class name
--EXTENSIONS--
pgsql
--SKIPIF--
<?php
include("inc/skipif.inc");
?>
--FILE--
<?php
interface I {}
abstract class C {}
enum E {
case A;
}
include "inc/config.inc";
$table_name = "pg_fetch_object_abstract_class";
$db = pg_connect($conn_str);
pg_query($db, "CREATE TABLE {$table_name} (a integer, b text)");
pg_query($db, "INSERT INTO {$table_name} VALUES(0, 'ABC')");
$sql = "SELECT * FROM $table_name WHERE a = 0";
try {
$result = pg_query($db, $sql);
var_dump(pg_fetch_object($result, NULL, 'I'));
} catch(Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
$result = pg_query($db, $sql);
var_dump(pg_fetch_object($result, NULL, 'C'));
} catch(Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
try {
$result = pg_query($db, $sql);
var_dump(pg_fetch_object($result, NULL, 'E'));
} catch(Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}
?>
--CLEAN--
<?php
include('inc/config.inc');
$db = @pg_connect($conn_str);
@pg_query($db, "DROP TABLE IF EXISTS pg_fetch_object_abstract_class cascade");
?>
--EXPECT--
Error: Cannot instantiate interface I
Error: Cannot instantiate abstract class C
Error: Cannot instantiate enum E