|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14922 OCIBindByName forcing length to 1, even though 0 is a valid length
Submitted: 2002-01-07 18:37 UTC Modified: 2002-01-08 14:54 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: alester at flr dot follett dot com Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.1.0 OS: Solaris
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: alester at flr dot follett dot com
New email:
PHP Version: OS:


 [2002-01-07 18:37 UTC] alester at flr dot follett dot com
It seems that the when oci8.c forces value_sz to 1 if it's 0 is bypassing a perfectly valid use of a length of 0: To signify a null.  



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-08 14:27 UTC] alester at flr dot follett dot com
Thies sent this to me:

    to pass a null thru a bound variable simply assign the
    special value NULL to the bound php-variable. the size
    supplied to ocibindbyname is simple the max-length of the
    inbound variable.

    $name = NULL;

    -> ":NAME" will have the value null in the query 

    please verify and close the report.

It seems incorrect to me to tweak a value that the underlying API expects to be able to handle.

Also, this handling of NULL should be documented in the OCIBindByName doc.
 [2002-01-08 14:54 UTC]
i'm pretty sure that the "If the value_sz parameter is zero, Oracle treats the bind variable as a null" is a 
new feature > 8.0. the "old" way is to set the indicator to -1 in the bind-in callback, which is what the 
oci8.c does.

i also believe that it makes way more sense to make the decision in the ociexecute (by looking at the actual 
php-variable) and not during bind for various reasons (think of mass inserts using bound variables).

BTW: you are welcome to contribute the documentation for NULL binds.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Apr 01 07:03:36 2023 UTC