php.net |  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
Votes:1
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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: geoffwa at cs dot rmit dot edu dot au
New email:
PHP Version: OS:

 

 [2006-05-17 06:31 UTC] geoffwa at cs dot rmit dot edu dot au
Description:
------------
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:
http://goanna.cs.rmit.edu.au/~geoffwa/oci8_php_crash/index.html


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);
oci_execute($sth);
oci_execute($cursor);
oci_fetch_array($cursor);
oci_free_statment($sth);
oci_free_statment($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
oci_execute($cursor);
oci_fetch_array($cursor);
oci_free_statment($sth);
oci_free_statment($cursor);

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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-17 06:49 UTC] tony2001@php.net
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: http://goanna.cs.rmit.edu.au/~geoffwa/oci8_php_crash/test.phps

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-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 05:01:27 2024 UTC