1--TEST-- 2Bug #40078 (ORA-01405 when fetching NULL values using oci_bind_array_by_name()) 3--EXTENSIONS-- 4oci8 5--SKIPIF-- 6<?php 7require_once 'skipifconnectfailure.inc'; 8$target_dbs = array('oracledb' => true, 'timesten' => false); // test runs on these DBs 9require __DIR__.'/skipif.inc'; 10?> 11--FILE-- 12<?php 13 14require __DIR__.'/connect.inc'; 15 16$create_pkg = " 17CREATE OR REPLACE PACKAGE BUG40078_PKG AS 18 TYPE ARRTYPE IS TABLE OF VARCHAR(20) INDEX BY BINARY_INTEGER; 19 PROCEDURE nullbind(c1 OUT ARRTYPE); 20END BUG40078_PKG;"; 21$statement = oci_parse($c, $create_pkg); 22oci_execute($statement); 23 24$create_pkg_body = " 25CREATE OR REPLACE PACKAGE BODY BUG40078_PKG AS 26 PROCEDURE nullbind(c1 OUT ARRTYPE) IS 27 BEGIN 28 c1(1) := 'one'; 29 c1(2) := 'two'; 30 c1(3) := ''; 31 c1(4) := 'four'; 32 c1(5) := 'five'; 33 END nullbind; 34END BUG40078_PKG;"; 35$statement = oci_parse($c, $create_pkg_body); 36oci_execute($statement); 37 38$statement = oci_parse($c, "BEGIN bug40078_pkg.nullbind(:c1); END;"); 39 40oci_bind_array_by_name($statement, ":c1", $array, 5, 20, SQLT_CHR); 41 42oci_execute($statement); 43 44var_dump($array); 45 46echo "Done\n"; 47?> 48--EXPECT-- 49array(5) { 50 [0]=> 51 string(3) "one" 52 [1]=> 53 string(3) "two" 54 [2]=> 55 string(0) "" 56 [3]=> 57 string(4) "four" 58 [4]=> 59 string(4) "five" 60} 61Done 62