forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdo_036.phpt
43 lines (38 loc) · 918 Bytes
/
pdo_036.phpt
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--
Testing PDORow and PDOStatement instances with Reflection
--EXTENSIONS--
pdo
--FILE--
<?php
$instance = new reflectionclass('pdostatement');
$x = $instance->newInstance();
var_dump($x);
// Allow initializing assignment.
$x->queryString = "SELECT 1";
var_dump($x);
// But don't allow reassignment.
try {
$x->queryString = "SELECT 2";
var_dump($x);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
$instance = new reflectionclass('pdorow');
$x = $instance->newInstance();
var_dump($x);
?>
--EXPECTF--
object(PDOStatement)#%d (0) {
["queryString"]=>
uninitialized(string)
}
object(PDOStatement)#2 (1) {
["queryString"]=>
string(8) "SELECT 1"
}
Property queryString is read only
Fatal error: Uncaught PDOException: You may not create a PDORow manually in %spdo_036.php:%d
Stack trace:
#0 %spdo_036.php(%d): ReflectionClass->newInstance()
#1 {main}
thrown in %spdo_036.php on line %d