php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #38905 RAW values returned inconsistently
Submitted: 2006-09-20 18:39 UTC Modified: 2006-10-03 01:00 UTC
From: david at acz dot org Assigned:
Status: No Feedback Package: OCI8 related
PHP Version: 5.1.6 OS: SuSE Linux
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-09-20 18:39 UTC] david at acz dot org
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 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-09-25 07:24 UTC] tony2001@php.net
Please try OCI8 from PECL: http://pecl.php.net/oci8
 [2006-10-03 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 01:01:28 2024 UTC