File tree Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Expand file tree Collapse file tree 1 file changed +57
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ PDO Common: Attempting to initialize an opaque object via PDO::FETCH_CLASS
3+ --EXTENSIONS--
4+ pdo
5+ --SKIPIF--
6+ <?php
7+ $ dir = getenv ('REDIR_TEST_DIR ' );
8+ if (false == $ dir ) die ('skip no driver ' );
9+ require_once $ dir . 'pdo_test.inc ' ;
10+ PDOTest::skip ();
11+ ?>
12+ --FILE--
13+ <?php
14+ if (getenv ('REDIR_TEST_DIR ' ) === false ) putenv ('REDIR_TEST_DIR= ' .__DIR__ . '/../../pdo/tests/ ' );
15+ require_once getenv ('REDIR_TEST_DIR ' ) . 'pdo_test.inc ' ;
16+ $ db = PDOTest::factory ();
17+
18+ $ db ->exec ('CREATE TABLE pdo_fetch_class_opaque_object(id int NOT NULL PRIMARY KEY, path VARCHAR(10)) ' );
19+ $ db ->exec ("INSERT INTO pdo_fetch_class_opaque_object VALUES(1, 'AA') " );
20+ $ db ->exec ("INSERT INTO pdo_fetch_class_opaque_object VALUES(2, 'BB') " );
21+ $ db ->exec ("INSERT INTO pdo_fetch_class_opaque_object VALUES(3, 'CC') " );
22+
23+ $ stmt = $ db ->prepare ('SELECT path FROM pdo_fetch_class_opaque_object ' );
24+ $ stmt ->execute ();
25+
26+ var_dump ($ stmt ->fetchAll (PDO ::FETCH_CLASS , 'Directory ' , []));
27+ ?>
28+ --CLEAN--
29+ <?php
30+ require_once getenv ('REDIR_TEST_DIR ' ) . 'pdo_test.inc ' ;
31+ $ db = PDOTest::factory ();
32+ PDOTest::dropTableIfExists ($ db , "pdo_fetch_class_opaque_object " );
33+ ?>
34+ --EXPECTF--
35+ array(3) {
36+ [0]=>
37+ object(Directory)#%s (1) {
38+ ["path"]=>
39+ string(2) "AA"
40+ ["handle"]=>
41+ uninitialized(mixed)
42+ }
43+ [1]=>
44+ object(Directory)#%s (1) {
45+ ["path"]=>
46+ string(2) "BB"
47+ ["handle"]=>
48+ uninitialized(mixed)
49+ }
50+ [2]=>
51+ object(Directory)#%s (1) {
52+ ["path"]=>
53+ string(2) "CC"
54+ ["handle"]=>
55+ uninitialized(mixed)
56+ }
57+ }
You can’t perform that action at this time.
0 commit comments