From: david at acz dot org
Operating system: SuSE Linux
PHP version: 5.1.6
PHP Bug Type: OCI8 related
Bug description: RAW values returned inconsistently
Description:
------------
RAW columns are sometimes returned as binary and sometimes as hex. When
this happens seems to be dependent on the driver version, but I don't know
of a reliably way to detect this in application code.
The 9.2 client returns hex. The 10.2 instant client returns binary.
Reproduce code:
---------------
echo "PHP " . PHP_VERSION . "\n";
$db = oci_connect($user, $pass, $tns);
echo oci_server_version($db) . "\n";
$st = oci_parse($db, "SELECT x FROM raw_test ORDER BY x");
oci_execute($st);
echo "type: " . oci_field_type($st, 1) . "\n";
echo "type_raw: " . oci_field_type_raw($st, 1) . "\n";
echo "size: " . oci_field_size($st, 1) . "\n";
oci_fetch_all($st, $x, 0, -1, OCI_FETCHSTATEMENT_BY_ROW | OCI_NUM);
foreach ($x as $i)
var_dump($i[0]);
ob_start(); phpinfo(); $x = strip_tags(ob_get_contents());
ob_end_clean(); $x = explode("\n", $x);
foreach ($x as $i)
if (substr($i, 0, 7) == "Oracle ")
echo "$i\n";
Expected result:
----------------
Create a test table:
CREATE TABLE raw_test (x RAW(4) NOT NULL);
INSERT INTO raw_test VALUES('54455354');
INSERT INTO raw_test VALUES('424C4148');
INSERT INTO raw_test VALUES('61626364');
Actual result:
--------------
First machine:
PHP 5.1.2
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit
Production
With the Partitioning, OLAP and Data Mining options
type: RAW
type_raw: 23
size: 4
string(8) "424C4148"
string(8) "54455354"
string(8) "61626364"
Oracle Version 9.2
Second machine:
PHP 5.1.6
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - 64bit
Production
With the Partitioning, OLAP and Data Mining options
type: RAW
type_raw: 23
size: 4
string(4) "BLAH"
string(4) "TEST"
string(4) "abcd"
Oracle Instant Client Version 10.2
--
Edit bug report at http://bugs.php.net/?id=38905&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=38905&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=38905&r=trysnapshot52
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=38905&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38905&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=38905&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38905&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38905&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38905&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38905&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38905&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=38905&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=38905&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38905&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38905&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38905&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38905&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38905&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38905&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38905&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38905&r=mysqlcfg