[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pecl-cvs
Subject:    [PECL-CVS] [pecl-database-ibm_db2] master: Workaround for empty/all whitespace string on trim
From:       Calvin Buckley <noreply () php ! net>
Date:       2022-12-27 19:46:33
Message-ID: A1l4y6gCK6A7D24pgFxDQhjzMvukwKKapf8k2d1TmhU () main ! php ! net
[Download RAW message or body]

Author: Calvin Buckley (NattyNarwhal)
Date: 2022-12-27T15:34:31-04:00

Commit: https://github.com/php/pecl-database-ibm_db2/commit/fb50e0b10b0d0dc8ddd5f220e39d95afcb655c23
 Raw diff: https://github.com/php/pecl-database-ibm_db2/commit/fb50e0b10b0d0dc8ddd5f220e39d95afcb655c23.diff


Workaround for empty/all whitespace string on trim

Changed paths:
  M  ibm_db2.c


Diff:

diff --git a/ibm_db2.c b/ibm_db2.c
index 6e66a8d..f1249b6 100644
--- a/ibm_db2.c
+++ b/ibm_db2.c
@@ -6265,6 +6265,11 @@ static void \
_php_db2_bind_fetch_helper(INTERNAL_FUNCTION_PARAMETERS, int op)  i5trim++;
                             break;
                         }
+                        // CB 20221227: fix from Luca for all-space/empty strings
+                        // ugly, but works
+                        if (i5trim < 0) {
+                            i5trim = 0;
+                        }
                         if ( op & DB2_FETCH_ASSOC ) {
                             add_assoc_stringl(return_value, (char \
*)stmt_res->column_info[i].name,  (char *)row_data->str_val, i5trim);

-- 
PECL CVS Mailing List 
To unsubscribe, visit: http://www.php.net/unsub.php


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic