Re: Bug #10292: Corrupted VARCHAR values from SELECT when used in arrays or array functions

From: Date: Tue, 24 Apr 2001 21:52:58 +0000
Subject: Re: Bug #10292: Corrupted VARCHAR values from SELECT when used in arrays or array functions
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-52323@lists.php.net to get a copy of this message
Hi, I have tracked down the bug in ./ext/interbase/interbase.c. I have posted the bugfix on the web-site as a diff between version 1.48 and the fixed version. Also bug #9257 has been identified and fixed. The diff has been posted under _bug_-report #10458 :-) Yours sincerely, Lars Westermann On 11 Apr 2001 11:33:55 -0700, lawe@tdk.dk wrote: >From: lawe@tdk.dk >Operating system: Linux / Windows >PHP version: 4.0.4pl1 >PHP Bug Type: InterBase related >Bug description: Corrupted VARCHAR values from SELECT when used in arrays or array functions > >// f1 and f2 are of type varchar >$id=ibase_query($tr_id, "SELECT f1, f2 FROM t1;"); >$res = ibase_fetch_row($id); >echo "'".$res[0]."'"; // Working fine >$arr[$res[0]] = 1; >$arr[$res[1]] = 2; >foreach ($res as $r => $v) > echo "'$r'\n"; // will in some cases add unexpected > // characters to end of $r > // It is the same with each construct >// The same applies to ibase_fetch_object() > >The values in the database are correct, as the unwanted characters may vary depending on the >number of columns in the select-statement. But it is always the same characters on repeated >executions. >I have made a work-around in a way like this: >$arr[str_pad($res[0], -1)] = 1; > >I think it has something to do with the Interbase-API, as it is the same errors regardless of >the Webserver (Apache 1.3.14 & 1.3.19, PHP 4.0.4pl1 or Win9x PWS, CGI or ISAPI version of PHP >4.0.4pl1) connecting to Interbase 6.01 on RedHat 6.1 and RedHat 6.2 > >The bug was first observed when doing a split(), where the last element in the resulting array >had strange characters attached to the end. > >PHP configured with minimal changes to defaults (Interbase support, enable-track-vars). > >Hope this is sufficient information, otherwise write me for further info, and I will try to >deliver it (if I can). > >Regards >/Lars > > >-- >Edit Bug report at: http://bugs.php.net/?id=10292&edit=1

« previous php.dev (#52323) next »