PHP 4.0 Bug #5444: Long VARCHARs create invalid strings
| From: | schmidt at bcc dot de | Date: | Fri, 07 Jul 2000 19:23:40 +0000 |
| Subject: | PHP 4.0 Bug #5444: Long VARCHARs create invalid strings | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-23743@lists.php.net to get a copy of this message | ||
From: schmidt@bcc.de
Operating system: linux 2.2 / glibc 2.1.3
PHP version: 4.0.1pl2
PHP Bug Type: Oracle related
Bug description: Long VARCHARs create invalid strings
Any select command on VARCHARS (256+) does not return a "regular" string, but (following a
tcpdump) contains 0<CHAR>0<CHAR>0<CHAR>...
This causes a non-display with Netscape (not even visible in page source) 4.7x on Linux & Win
(at least). Lynx and MSIE (at least) do work.
I consider this a bug, as with PHP 3 the output was valid (and visible with Netscape).
I'm using Oracle 8.0.5.0.0 Linux - my PHP configuration command was
--without-pgsql --without-mysql --with-oci8 --with-zlib --sysconfdir=/etc --without-gd --with-apxs
The webserver is not the same as the db machine, if this matters.
The table is like
create table tab (col1 varchar(256), col2 varchar(256), col3 varchar(256))
and the code used to print looks like
function _db_nextresult($result) {
if (OCIFetchInto($result, $fetcharray, OCI_ASSOC)) {
return $fetcharray;
} else {
return false;
}
}
for ($result_b = _db_nextresult ($result), $i=0; $result_b; $i++) {
while (list ($key, $val) = each ($result_b) ) {
echo "$key - $val<BR>";
}
$result_b = _db_nextresult ($result);
}
Note that with
printf ("%s - %s<BR>\n", $key, $val);
you wan't see a single thing, not even with lynx or MSIE, as IMHO the zero in the string
terminates it before the first character is printed. It also becomes quite difficult to parse the
string and replace the zeroes....
If you want to take a look at it, feel free to visit
http://something.bcc.de/test.php for a php test and
http://something.bcc.de/t2.php for the problem...