From:             [EMAIL PROTECTED]
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



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to