#36974 [NEW]: ORA-01405: fetched column value is NULL on LOB fields in 10g
From: crescentfreshpot at yahoo dot com
Operating system: Win 2000, Win XP
PHP version: 5.1.2
PHP Bug Type: PDO related
Bug description: ORA-01405: fetched column value is NULL on LOB fields in 10g
Description:
------------
pdo_oci does not convert oracle nulls to php nulls when fetching from lob
fields. Appears in 5.0.5 to 5.1.2 versions of php/pdo/pdo_oci. Oracle
version is 10g. Non-lob fields appear to convert just fine.
Setting the PDO::ATTR_ORACLE_NULLS driver attribute to PDO::NULL_TO_STRING
and/or PDO::NULL_EMPTY_STRING has no effect.
I'm aware that this behaviour is 'by design' for oracle but was led to
believe by the docs that pdo handled nulls for me so I don't have to
resort to using NVL(...) in my queries.
Reproduce code:
---------------
<?php
error_reporting(E_ALL);
$dbh = new PDO('oci:', 'scott', 'tiger');
$dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
var_dump($dbh->query("SELECT * FROM
SCOTT.EMP")->fetch(PDO::FETCH_ASSOC));
if($dbh->exec("ALTER TABLE SCOTT.EMP ADD (PIC BLOB)") === false) {
die("ALTER TABLE failed.");
}
var_dump($dbh->query("SELECT * FROM
SCOTT.EMP")->fetch(PDO::FETCH_ASSOC));
$dbh->exec("ALTER TABLE SCOTT.EMP DROP (PIC)");
?>
Expected result:
----------------
array(8) {
["EMPNO"]=>
string(4) "7369"
["ENAME"]=>
string(5) "SMITH"
["JOB"]=>
string(5) "CLERK"
["MGR"]=>
string(4) "7902"
["HIREDATE"]=>
string(9) "17-DEC-80"
["SAL"]=>
string(3) "800"
["COMM"]=>
NULL
["DEPTNO"]=>
string(2) "20"
}
array(8) {
["EMPNO"]=>
string(4) "7369"
["ENAME"]=>
string(5) "SMITH"
["JOB"]=>
string(5) "CLERK"
["MGR"]=>
string(4) "7902"
["HIREDATE"]=>
string(9) "17-DEC-80"
["SAL"]=>
string(3) "800"
["COMM"]=>
NULL
["DEPTNO"]=>
string(2) "20"
["PIC"]=>
NULL
}
Actual result:
--------------
array(8) {
["EMPNO"]=>
string(4) "7369"
["ENAME"]=>
string(5) "SMITH"
["JOB"]=>
string(5) "CLERK"
["MGR"]=>
string(4) "7902"
["HIREDATE"]=>
string(9) "17-DEC-80"
["SAL"]=>
string(3) "800"
["COMM"]=>
NULL
["DEPTNO"]=>
string(2) "20"
}
<br />
<b>Warning</b>: PDOStatement::fetch() [<a
href='function.fetch'>function.fetch</a>]: SQLSTATE[HY000]: General error:
1405 OCIStmtFetch: ORA-01405: fetched column value is NULL
(..\pecl_5_0\pdo_oci\oci_statement.c:446) in <b>C:\dev\tests\db.php</b>
on line <b>13</b><br />
bool(false)
--
Edit bug report at http://bugs.php.net/?id=36974&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36974&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36974&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36974&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36974&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36974&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36974&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36974&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36974&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36974&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36974&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36974&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36974&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36974&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36974&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36974&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36974&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36974&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36974&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36974&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36974&r=mysqlcfg
Thread (6 messages)
- crescentfreshpot at yahoo dot com