From:             fsurleau at skyservices dot net
Operating system: RedHat EL4
PHP version:      5.2.1RC2
PHP Bug Type:     OCI8 related
Bug description:  oci_bind_array_by_name with NULL => ORA-01405 

Description:
------------
When the returned Oracle table contains at least one NULL, oci_execute()
fails: ORA-01405: fetched column value is NULL.

Regards,
Fred.

Reproduce code:
---------------
<?php
$c = oci_connect("scott", "tiger");

$create_pkg = "
CREATE OR REPLACE PACKAGE ARRAYBINDPKG1 AS
    TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER;
    PROCEDURE nullbind(c1 OUT ARRTYPE);
END ARRAYBINDPKG1;";
$statement = oci_parse($c, $create_pkg);
oci_execute($statement);

$create_pkg_body = "
CREATE OR REPLACE PACKAGE BODY ARRAYBINDPKG1 AS
    PROCEDURE nullbind(c1 OUT ARRTYPE) IS
    BEGIN
        c1(1) := 'one';
        c1(2) := 'two';
        c1(3) := '';   -- <= This cause ORA-01405
        c1(4) := 'four';
        c1(5) := 'five';
    END nullbind;
END ARRAYBINDPKG1;";
$statement = oci_parse($c, $create_pkg_body);
oci_execute($statement);

$statement = oci_parse($c, "BEGIN ARRAYBINDPKG1.nullbind(:c1); END;");

oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR);

oci_execute($statement);

var_dump($array);
?>


Expected result:
----------------
array(5) { [0]=>  string(3) "one" [1]=>  string(3) "two" [2]=>  string(1)
"" [3]=>  string(4) "four" [4]=>  string(4) "five" }

Actual result:
--------------
oci_execute() [function.oci-execute]: ORA-01405

-- 
Edit bug report at http://bugs.php.net/?id=40078&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=40078&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=40078&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=40078&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=40078&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=40078&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=40078&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=40078&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=40078&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=40078&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=40078&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=40078&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=40078&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=40078&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=40078&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=40078&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=40078&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=40078&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=40078&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=40078&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=40078&r=mysqlcfg

Reply via email to