php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26892 ocinewcollection fails with Oracle 9.2
Submitted: 2004-01-13 06:37 UTC Modified: 2004-01-15 10:10 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: tomy at envox dot hr Assigned: tony2001 (profile)
Status: Closed Package: OCI8 related
PHP Version: 4CVS-2004-01-13 (stable) OS: Suse 8.2
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:
MUST BE VALID
Solve the problem:
18 - 1 = ?
Subscribe to this entry?

 
 [2004-01-13 06:37 UTC] tomy at envox dot hr
Description:
------------
ocinewcollection returns false and produces a warning, output with oci debug enabled follows in actual result.

I have checked in source and using oci_debug that OCIInitialize is called using OCI_DEFAULT | OCI_OBJECT so I do not understand why this error happens.

PHP is compiled using this configure:
"
'./configure' '--enable-sigchild' '--disable-static' '--enable-track-vars' '--enable-trans-sid' '--enable-sockets' '--with-mysql' '--with-xml' '--disable-rpath' '--disable-pic' '--disable-posix' '--with-zlib' '--without-pear' '--without-aspell' '--disable-dbase' '--disable-dba' '--without-mhash' '--without-gmp' '--with-gnu-ld' '--disable-bcmath' '--without-cdb' '--without-db3' '--without-db2' '--without-gdbm' '--without-ndbm' '--without-dbm' '--without-dom' '--enable-mbstring' '--enable-mbstr-enc-trans' '--with-recode' '--with-gd' '--enable-shmop' '--enable-sysvsem' '--with-xmlrpc' '--with-oci8' '--with-mcrypt' '--with-apxs' "

LOCAL_ID_ARRAY is defined as:
"
CREATE OR REPLACE TYPE local_id_array AS TABLE OF NUMBER(11);
"

Reproduce code:
---------------
$_db_tns = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.41)(PORT=1521)))(CONNECT_DATA=(SID=pirana)(SERVER=DEDICATED)))";
$_db_user = "system";
$_db_pwd = "pirana";


   ociinternaldebug(1);
   $db = ocinlogon($_db_user, $_db_pwd, $_db_tns);
   $arr = ocinewcollection($db, 'LOCAL_ID_ARRAY');
   if ($arr === false) echo "Collection failed<br>";


Expected result:
----------------
I expect only oci debug data to be written.

Actual result:
--------------
$arr should be OCI-Collection however it is false.

Actual output is:
"
OCIDebug: _oci_open_server new conn=0 dname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.41)(PORT=1521)))(CONNECT_DATA=(SID=pirana)(SERVER=DEDICATED)))
OCIDebug: _oci_open_session new sess=5 user=system
OCIDebug: oci_do_connect: id=6

Warning: ocinewcollection(): OCITypeByName: ORA-21301: not initialized in object mode in /srv/www/htdocs/envox/info2.php on line 18
Collection failed
OCIDebug: START php_rshutdown_oci
OCIDebug: END php_rshutdown_oci
OCIDebug: START _oci_coll_list_dtor: 7
OCIDebug: START _oci_conn_list_dtor: id=6
OCIDebug: nothing to do..
OCIDebug: START _oci_close_session: logging-off sess=5
OCIDebug: END _oci_conn_list_dtor: id=6
OCIDebug: END _oci_coll_list_dtor: 7
OCIDebug: START _oci_close_server: detaching conn=4 dbname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.41)(PORT=1521)))(CONNECT_DATA=(SID=pirana)(SERVER=DEDICATED)))
"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-13 06:42 UTC] tomy at envox dot hr
Forgot to mention my oci data from phpinfo...:
OCI8 Support  enabled  
Revision  $Revision: 1.183.2.7 $  
Oracle Version  9.2  
Compile-time ORACLE_HOME  /opt/oracle/product/9ir2  
Libraries Used  no value
 [2004-01-13 11:24 UTC] tomy at envox dot hr
Did some trial/error testing with earlier PHP versions and
found out that this problem does not exist with version 4.3.1, appears in version 4.3.2 and exists ever since...
It is even possible to bypass it by copying 4.3.1 oci extension source to latest CVS snapshot and then the problem does not exist anymore.
Also it seems, although I cannot confirm that with 100% certainity, that it only exists if 9.2 client is used by php. It seems that 8.0 client is not affected.
Hope this helps.
 [2004-01-13 13:44 UTC] tony2001@php.net
Please, try PHP5 latest snapshots and check if it works with them.
 [2004-01-15 01:26 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

The *COLLECTIONS* defines have been fixed.

 [2004-01-15 03:47 UTC] tomy at envox dot hr
The *COLLECTIONS* defines have NOT been fixed!!!
At least not in php5-200401150630 found in 
http://snaps.php.net/php5-latest.tar.gz.

You still define HAVE_OCI8_COLLECTIONS in configure and use PHP_OCI8_HAVE_COLLECTIONS in ext/oci8/oci8.c. Also have HAVE_OCI8_COLLECTIONS in all other files and once in ext/oci8/oci8.c. The one use of HAVE_OCI8_COLLECTIONS is conviniently placed in PHP_MINFO_FUNCTION so phpinfo() says that collection support is enabled. However all collection methods are wrapped inside PHP_OCI8_HAVE_COLLECTIONS so they are actually not present.

Simple recursive search yields:

Find 'PHP_OCI8_HAVE_COLLECTIONS' in 'ext/oci8/oci8.c' :
ext/oci8/oci8.c/84: #ifdef PHP_OCI8_HAVE_COLLECTIONS 
ext/oci8/oci8.c/90: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/193: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/208: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/262: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/351: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/434: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/484: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/523: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/602: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/608: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/616: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/648: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/655: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/660: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/685: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/1051: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/1412: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/3604: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/3633: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/3751: #ifdef PHP_OCI8_HAVE_COLLECTIONS
ext/oci8/oci8.c/6221: #ifdef PHP_OCI8_HAVE_COLLECTIONS

Find 'HAVE_OCI8_COLLECTIONS' in 'configure' :
configure/57304: #define HAVE_OCI8_COLLECTIONS 1
ext/oci8/config.m4/146:     AC_DEFINE(HAVE_OCI8_COLLECTIONS,1,[ ])
ext/oci8/oci8.c/806: #ifdef HAVE_OCI8_COLLECTIONS
main/php_config.h.in/1826: #undef HAVE_OCI8_COLLECTIONS

Also after having fixed defines by replacing all PHP_OCI8_HAVE_COLLECTIONS with HAVE_OCI8_COLLECTIONS the original bug remains!!!!!!!!
 [2004-01-15 05:27 UTC] sniper@php.net
The snapshot is too old. (the 'typo' is fixed in CVS, snapshot just doesn't have the changes in it yet)
Get the latest snapshot now.

 [2004-01-15 06:00 UTC] tomy at envox dot hr
The *COLLECTIONS* defines have been fixed now.

Unfortunately the original bug submitted still exists!

Output from reproducable script follows (ocinewcollection fails and returns false with a warning):
"
OCIDebug: _oci_open_server new conn=0 dname=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.3.41)(PORT=1521)))(CONNECT_DATA=(SID=pirana)(SERVER=DEDICATED)))
OCIDebug: _oci_open_session new sess=3 user=system
OCIDebug: oci_do_connect: id=4

Warning: ocinewcollection() [function.ocinewcollection]: OCITypeByName: ORA-21301: not initialized in object mode in /srv/www/htdocs/envox/info2.php on line 14
Collection failed
OCIDebug: START php_rshutdown_oci
OCIDebug: END php_rshutdown_oci
OCIDebug: START _oci_coll_list_dtor: 5
OCIDebug: END _oci_coll_list_dtor: 5
OCIDebug: START _oci_conn_list_dtor: id=4
OCIDebug: nothing to do..
OCIDebug: START _oci_close_session: logging-off sess=3
OCIDebug: END _oci_conn_list_dtor: id=4
"
 [2004-01-15 09:34 UTC] tony2001@php.net
I'm currently working on it.
 [2004-01-15 10:10 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.

Thanks for reporting.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 01:01:31 2024 UTC