File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 47
47
# Expected to fail; unless told otherwise, PDO assumes string inputs
48
48
# false -> "" as string, which pgsql doesn't like
49
49
if (!$ res ->execute (array (false )))
50
- print_r ($ res ->errorInfo ());
50
+ print_r (normalizeErrorInfo ( $ res ->errorInfo () ));
51
51
else
52
52
print_r ($ res ->fetchAll (PDO ::FETCH_ASSOC ));
53
53
83
83
# Expected to fail; unless told otherwise, PDO assumes string inputs
84
84
# false -> "" as string, which pgsql doesn't like
85
85
if (!$ res ->execute (array (false ))) {
86
- $ err = $ res ->errorInfo ();
87
- // Strip additional lines outputted by recent PgSQL versions
88
- $ err [2 ] = trim (current (explode ("\n" , $ err [2 ])));
89
- print_r ($ err );
86
+ print_r (normalizeErrorInfo ($ res ->errorInfo ()));
90
87
} else {
91
88
print_r ($ res ->fetchAll (PDO ::FETCH_ASSOC ));
92
89
}
90
+
91
+ function normalizeErrorInfo (array $ err ): array {
92
+ // Strip additional lines outputted by recent PgSQL versions
93
+ $ err [2 ] = trim (current (explode ("\n" , $ err [2 ])));
94
+ return $ err ;
95
+ }
96
+
93
97
?>
94
98
--EXPECTF--
95
99
Array
You can’t perform that action at this time.
0 commit comments