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 45
45
# Expected to fail; unless told otherwise, PDO assumes string inputs
46
46
# false -> "" as string, which pgsql doesn't like
47
47
if (!$ res ->execute (array (false )))
48
- print_r ($ res ->errorInfo ());
48
+ print_r (normalizeErrorInfo ( $ res ->errorInfo () ));
49
49
else
50
50
print_r ($ res ->fetchAll (PDO ::FETCH_ASSOC ));
51
51
81
81
# Expected to fail; unless told otherwise, PDO assumes string inputs
82
82
# false -> "" as string, which pgsql doesn't like
83
83
if (!$ res ->execute (array (false ))) {
84
- $ err = $ res ->errorInfo ();
85
- // Strip additional lines outputted by recent PgSQL versions
86
- $ err [2 ] = trim (current (explode ("\n" , $ err [2 ])));
87
- print_r ($ err );
84
+ print_r (normalizeErrorInfo ($ res ->errorInfo ()));
88
85
} else {
89
86
print_r ($ res ->fetchAll (PDO ::FETCH_ASSOC ));
90
87
}
88
+
89
+ function normalizeErrorInfo (array $ err ): array {
90
+ // Strip additional lines outputted by recent PgSQL versions
91
+ $ err [2 ] = trim (current (explode ("\n" , $ err [2 ])));
92
+ return $ err ;
93
+ }
94
+
91
95
?>
92
96
--EXPECTF--
93
97
Array
You can’t perform that action at this time.
0 commit comments