From:             michael dot virnstein at brodos dot de
Operating system: Linux
PHP version:      5.2.5
PHP Bug Type:     OCI8 related
Bug description:  Segmentation Fault when calling PL/SQL-function wich returns 
ref cursor

Description:
------------
PHP: since 5.2.4
Apache: 2.2.6
Oracle DB: 10.2.0.3.0
Oracle-Client: 10.2.0.3
OS: Linux

When i'm calling a PL/SQL-function, which returns a ref cursor, more than
once, php segfaults. When i call the PL/SQL-function only once, everything
works. 
 
The bug is present since PHP 5.2.4, which introduced OCI 1.2.4

Create the following Oracle-package:

create or replace package testpackage 
is
  type cursortype is ref Cursor;
  
  function testcursor return cursortype;

end testpackage;
/

create or replace package body testpackage 
is
   function testcursor return cursortype
   is
      retCursor cursorType;
   begin
      Open retCursor For 'select * from dual';
      return retCursor;
   end;
end testpackage;
/

Reproduce code:
---------------
<?php
$conn =  ocilogon('user', 'pass', 'db');

for ($i = 0; $i < 2; $i++)
{
    var_dump(getCur($conn));
}

function getCur($conn)
{   
    
    $cur = OCINewCursor($conn);
    $stmt = ociparse($conn, 'begin :cur := testpackage.testcursor;
end;');
    ocibindbyname($stmt, ':cur', $cur, -1, OCI_B_CURSOR);
    ociexecute($stmt, OCI_DEFAULT); // <-- segfault 
    ociexecute($cur, OCI_DEFAULT);
    
    $ret = array();
    
    while (ocifetchinto($cur, $row, OCI_ASSOC))
        $ret[] = $row;
    
    ocifreestatement($cur);
    ocifreestatement($stmt);
    return $ret;
}

?>

Expected result:
----------------
display var_dump result

Actual result:
--------------
apache segmentation fault

-- 
Edit bug report at http://bugs.php.net/?id=43449&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=43449&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=43449&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=43449&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=43449&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=43449&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=43449&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=43449&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=43449&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=43449&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=43449&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=43449&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=43449&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=43449&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=43449&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=43449&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=43449&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=43449&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=43449&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=43449&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=43449&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=43449&r=mysqlcfg

Reply via email to