File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -4940,8 +4940,14 @@ PHP_FUNCTION(db2_execute)
4940
4940
bindlen = tmp_curr -> bind_indicator ;
4941
4941
origptr [bindlen ] = '\0' ;
4942
4942
Z_STRLEN_P (tmp_curr -> value ) = bindlen ;
4943
- /* trim (IBM i may return 0x40 for EBCDIC space when not 1208 ccsid -- yes, db2 bug, just handle)*/
4944
- for (;bindlen && (origptr [bindlen ] == 0x20 || origptr [bindlen ] == 0x40 || origptr [bindlen ] == 0x00 ); bindlen -- ) {
4943
+ /*
4944
+ * trim (IBM i may return 0x40 for EBCDIC space when not 1208 ccsid -- yes, db2 bug, just handle)
4945
+ *
4946
+ * CB 20210426: when truncating, we might get an
4947
+ * empty string, so be sure we can nullify the
4948
+ * first character if needed
4949
+ */
4950
+ for (;bindlen >= 0 && (origptr [bindlen ] == 0x20 || origptr [bindlen ] == 0x40 || origptr [bindlen ] == 0x00 ); bindlen -- ) {
4945
4951
Z_STRLEN_P (tmp_curr -> value ) = bindlen ;
4946
4952
origptr [bindlen ] = '\0' ;
4947
4953
}
You can’t perform that action at this time.
0 commit comments