|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37471 Binding a cursor to a function that returns a cursor crashes PHP OCI
Submitted: 2006-05-17 06:31 UTC Modified: 2006-05-17 07:52 UTC
Avg. Score:4.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: geoffwa at cs dot rmit dot edu dot au Assigned:
Status: Closed Package: OCI8 related
PHP Version: 5.1.4 OS: Solaris 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
48 - 3 = ?
Subscribe to this entry?

 [2006-05-17 06:31 UTC] geoffwa at cs dot rmit dot edu dot au
Binding a cursor to a PL/SQL function that returns a cursor causes a segmentation fault in the PHP-OCI code when the PL/SQL function is called more than once.

While this isn't a strictly correct, as it leaves a dangling cursor, it doesn't crash PHP4 (which I am migrating from).

I've collected more information which is available at:

Reproduce code:
// Abbreivated example - assume connected $dbh and
// function that returns cursor
$query = "BEGIN :v_cursor := some_function(); END;";
$cursor = oci_new_cursor($dbh);
$sth = oci_parse($dbh, $query);
oci_bind_by_name($sth, ':v_cursor', $cursor,
   -1, OCI_B_CURSOR);
$sth = oci_parse($dbh, $query);
$cursor = oci_new_cursor($dbh);
oci_bind_by_name($sth, ':v_cursor', $cursor,
   -1, OCI_B_CURSOR);
oci_execute($sth); // <-- crash here

Expected result:
I expect the code to execute successfully, to not crash PHP, and to cleanup the cursors when the database handle is closed.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-17 06:49 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.

 [2006-05-17 07:52 UTC] geoffwa at cs dot rmit dot edu dot au
Test script available at:

I was actually running this with PHP 5.1.2, as there wasn't any mention of OCI fixes in the changelog of 5.1.3/4.

Having read the CVS tree, noticed the recent OCI module activity, built PHP 5.1.4, and tested it again I can report that this is fixed for 5.1.4.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Nov 30 10:03:35 2021 UTC