php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #65986 oci_fetch_all() returns NULL on failure
Submitted: 2013-10-28 20:12 UTC Modified: 2014-01-02 14:47 UTC
From: ashnazg@php.net Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
 [2013-10-28 20:12 UTC] ashnazg@php.net
Description:
------------
The documented behavior of oci_fetch_all() says it will return FALSE on failure.  However, it appears to return NULL instead.  This NULL behavior actually matches the failure behavior of other oci_fetch_*() methods, although those methods do not have a failure return value documented at all.

Presumably you want to either correct the documented behavior of oci_fetch_all(), or perhaps remove "failure behavior" from the its doc completely.

Test script:
---------------
$ret = 'before call';
$ret = oci_fetch_all(null);
var_dump($ret);

Expected result:
----------------
Warning: oci_fetch_all() expects at least 2 parameters, 1 given in /home/cburgess/test.php on line 4

Call Stack:
    0.0002     221104   1. {main}() /home/cburgess/test.php:0
    0.0002     221896   2. oci_fetch_all() /home/cburgess/test.php:4

FALSE

Actual result:
--------------
Warning: oci_fetch_all() expects at least 2 parameters, 1 given in /home/cburgess/test.php on line 4

Call Stack:
    0.0002     221104   1. {main}() /home/cburgess/test.php:0
    0.0002     221896   2. oci_fetch_all() /home/cburgess/test.php:4

NULL

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-31 18:58 UTC] frozenfire@php.net
-Status: Open +Status: Feedback
 [2013-12-31 18:58 UTC] frozenfire@php.net
Invocation errors (e.g. failing to supply the required number of parameters) generally result in a null return value in PHP. The failure condition that return value sections refer to is with regards to failure of the execution of the function when invoked correctly.

If you could, please provide a test script which demonstrates an OCI8 fetch failing due to another reason (e.g. failed execution of the query, perhaps?).
 [2014-01-02 14:47 UTC] ashnazg@php.net
-Status: Feedback +Status: Not a bug
 [2014-01-02 14:47 UTC] ashnazg@php.net
Never noted that NULL behavior as a generality like that, so that's good to know.  I had been writing test cases for error handling code and "oci_fetch_all(null)" seemed to be the simplest manner to get the expected FALSE return.  As best I remember, that kind of scheme worked as expected with the other oci_* functions I had to make fail, so I presumed this different behavior by oci_fetch_all() was a bug.

Thanks for the explanation.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 11:01:33 2024 UTC