php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33383 PHP crashes while retrieving data from Oracle
Submitted: 2005-06-17 13:05 UTC Modified: 2005-10-10 12:43 UTC
From: johnny at ouranous dot idv dot tw Assigned: tony2001 (profile)
Status: Closed Package: OCI8 related
PHP Version: 5CVS-2005-10-06 (snap, oci8-beta) OS: Solaris 9
Private report: No CVE-ID: None
 [2005-06-17 13:05 UTC] johnny at ouranous dot idv dot tw
Description:
------------
I think this bug is simular to Bug #6561 but in Solaris
I've test 3 different version of php in CGI/CLI mode all happended.

Here is my enviornment & configuration:
Sun V240(sparc)
Solaris 9
gcc 3.4.2
Oracle 9.2.0.4

php 4.3.11
CFLAGS="`getconf LFS_CFLAGS`" ./configure --prefix=/usr/local/php4 --with-oci8=/data/oracle/OraHome1 --with-ncurses=/usr/local/lib --enable-pcntl --with-readline=/usr/local/lib --enable-mbstring=all

php 5.0.3
CFLAGS="`getconf LFS_CFLAGS`" ./configure --prefix=/usr/local/php5 --with-oci8=/data/oracle/OraHome1 --with-ncurses=/usr/local/lib --enable-pcntl --with-readline=/usr/local/lib --enable-mbstring=all

php 5.0.4
CFLAGS="`getconf LFS_CFLAGS`" ./configure --prefix=/usr/local/php5 --with-oci8=/data/oracle/OraHome1 --with-ncurses=/usr/local/lib --enable-mbstring=all (cannot build with --enable-pcntl --with-readline=/usr/local/lib)

modified
1. <phpdir>/configure
2. <phpdir>/ext/oci8/config.m4

OCI8_DIR/lib -> OCI8_DIR/lib32
OCI8_DIR/rdbms/lib -> OCI8_DIR/rdbms/lib32

CGI/CLI crashed (core dumped) at some CLOB field
at ociFetchInto when ociFetchInto with OCI_RETURN_LOBS, and crashed at ->load() when ociFetchInto without OCI_RETURN_LOBS, same code runs fine is PHP4/PHP5 on windows

Reproduce code:
---------------
Very hard to reproduce exactly. It happens while retrieving data from an
Oracle 8 database. The same code works fine in Windows Environment.


Expected result:
----------------
  $query = "SELECT field1, clob1, field2 FROM table1";

  $stmt = OCIParse ($conn, $query);
  OCIExecute($stmt, OCI_DEFAULT);
  while( true )
  {
    if( !OCIFetchInto($stmt, $arr, OCI_ASSOC|OCI_RETURN_LOBS) )
      break;
    while( list($key,$val)=each($arr) )
    {
      echo "Key:".$key."\tVal:".$val."\n";
    }
    echo "\n";
  }


Actual result:
--------------
Key: xxxx Val: yyyyyy
Key: xxxx Val: yyyyyy
Key: xxxx Val: yyyyyy
Key: xxxx Val: yyyyyy
....


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-08 11:51 UTC] tony2001@php.net
Please try OCI8 v.1.1, which is available in CVS HEAD and PECL (use `pear install oci8-beta` to install it).
 [2005-10-04 08:54 UTC] johnny at ouranous dot idv dot tw
oci8-beta still got crashed. And there was something I forgot to mention. My Oracle 9i is configured to use UTF8.
 [2005-10-07 06:36 UTC] johnny at ouranous dot idv dot tw
Description:
------------
Crashed where clob field contains no data.

Reproduce code:
---------------
<?php

if (!extension_loaded('oci8'))
{
  dl('oci8.so');
}

$db_connect_id = OCINLogon( "username", "passwd", "dbserver" );

$query = SELECT guid,objcontent FROM objectcontent WHERE rownum < 10";

$stmt = OCIParse ($db_connect_id, $query);
OCIExecute($stmt, OCI_DEFAULT);
while( true )
{
  if( !OCIFetchInto($stmt, $arr, OCI_ASSOC|OCI_RETURN_LOBS) )
    break;
  while( list($key,$val)=each($arr) )
  {
    echo "Key:".$key."\tVal:".$val."\n";
  }
}
?>

Expected result:
----------------
Key:GUID        Val:0011856596F1-423F9E4F-05E6-C367-9C3C
Key:OBJCONTENT  Val:?X????y ??a??????ec ??2 ??:
Key:GUID        Val:0011856596F1-423F906A-0575-4A3D-F21A
Key:OBJCONTENT  Val:
Key:GUID        Val:0011856596F1-423F906C-01C6-8953-3638
Key:OBJCONTENT  Val:
Key:GUID        Val:0011856596F1-423F906E-02D6-EED9-B606
Key:OBJCONTENT  Val:?X????y ??a??????ec ??2 ??:
Key:GUID        Val:0011856596F1-423F9070-002C-1E4F-B904
Key:OBJCONTENT  Val:?X????y ??a??????ec ??2 ??:

Key:GUID        Val:0011856596F1-423F9072-022E-F935-14B2
Key:OBJCONTENT  Val:?X????y ??a??????ec ??2 ??:
Key:GUID        Val:0011856596F1-423F9074-0118-D30B-B890
Key:OBJCONTENT  Val:?X????y ??a??????ec ??2 ??:

Key:GUID        Val:0011856596F1-423F9075-0489-6151-A41E
Key:OBJCONTENT  Val:?X????y ??a??????ec ??2 ??:

Actual result:
--------------
Key:GUID        Val:0011856596F1-423F9E4F-05E6-C367-9C3C
Key:OBJCONTENT  Val:?X????y ??a??????ec ??2 ??:
Segmentation Fault (core dumped)
 [2005-10-07 09:33 UTC] sniper@php.net
Do not load the extension with dl()!! Put it in php.ini.
Using dl() is known to cause crashes in all usual and unusual ways..

 [2005-10-07 14:00 UTC] johnny at ouranous dot idv dot tw
Even if I remove the lines of dynamic loading and load oci8 in php.ini, the script still crashed.
And this time it cannot even print the first record.
 [2005-10-10 12:43 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC