Bug #72524 [NEW]: Binding null values triggers ORA-24816 error

From: Date: Thu, 30 Jun 2016 12:37:45 +0000
Subject: Bug #72524 [NEW]: Binding null values triggers ORA-24816 error
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201939@lists.php.net to get a copy of this message
From:             deeky666 at googlemail dot com
Operating system: Ubuntu 15.10
PHP version:      7.0.8
Package:          OCI8 related
Bug Type:         Bug
Bug description:Binding null values triggers ORA-24816 error

Description:
------------
There seems to be a difference between PHP5 and PHP7 in oci8 when
binding NULL values to LONG/LOB type columns.

In PHP5 it was possible to execute the following INSERT statement
without any error (sample):

INSERT INTO mytable VALUES (:clob_col, :varchar2_col)

If the value bound to parameter :varchar2_col is NULL, the following
error is triggered (no matter what value the parameter :clob_col is
bound to):

ORA-24816: Expanded non LONG bind data supplied after actual LONG or LOB
column

If you switch the parameter order and both parameter values are bound to
NULL, the same error occurs:

INSERT INTO mytable VALUES (:varchar2_col, :clob_col)

So no matter what order, not matter what value is bound to :clob_col, if
:varchar2_col is bound to NULL, the error occurs.

If you have only one VARCHAR2 column or two (without a CLOB column)
there also is no error.

Test script:
---------------
<?php

$conn = oci_connect('system', 'oracle',
'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT_DATA=(SID=xe)))');

$stmt = oci_parse($conn, 'DROP TABLE mytable');
oci_execute($stmt);

$stmt = oci_parse($conn, 'CREATE TABLE mytable ("clob_col" CLOB DEFAULT
NULL, "varchar2_col" VARCHAR2(255) DEFAULT NULL)');
oci_execute($stmt);

$stmt = oci_parse($conn, 'INSERT INTO mytable VALUES (:clob_col,
:varchar2_col)');

$clob = null;
$varchar2 = null;
oci_bind_by_name($stmt, ':clob_col', $clob);
oci_bind_by_name($stmt, ':varchar2_col', $varchar2);

var_dump(oci_execute($stmt));

Expected result:
----------------
bool(true)

Actual result:
--------------
PHP Warning:  oci_execute(): ORA-24816: Expanded non LONG bind data
supplied after actual LONG or LOB column in
/home/deeky/dev/doctrine/dbal/oci8_php7.php on line 14

Warning: oci_execute(): ORA-24816: Expanded non LONG bind data supplied
after actual LONG or LOB column in
/home/deeky/dev/doctrine/dbal/oci8_php7.php on line 14
bool(false)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=72524&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=72524&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=72524&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=72524&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=72524&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=72524&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=72524&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=72524&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=72524&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=72524&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=72524&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=72524&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=72524&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=72524&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72524&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=72524&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=72524&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=72524&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72524&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=72524&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=72524&r=mysqlcfg



Thread (6 messages)

« previous php.bugs (#201939) next »