php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11486 Oracle connection resource disappears in nested connections
Submitted: 2001-06-14 09:13 UTC Modified: 2002-08-19 11:18 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: alban dot hertroys at ddnh dot nl Assigned:
Status: Wont fix Package: Oracle related
PHP Version: 4.0.4pl1 OS: Debian Linux i686
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2001-06-14 09:13 UTC] alban dot hertroys at ddnh dot nl
If you do the following, the last ora_commit has a connection resource of type "unknown". The connection is gone!
With PHP3 this worked, as a new connection resource was opened for every ora_logon. In PHP4 the resource is being reused.

The ora_commit in the function is valid (type is "oracle link").

<?php
	define("username", "xxx");
	define("password", "xxx");

	function func1() {
		$conn = ora_logon(username, password);
		if (! $conn)	die ("No connection");
		ora_commitoff($conn);

		$curs = ora_open($conn);
		ora_parse($curs, "SELECT 1 FROM dual");
		ora_exec($curs);
		ora_close($curs);

		ora_commit($conn);
		ora_logoff($conn);
	}
	
	$conn = ora_logon(username, password);
	if (! $conn)	die ("No connection");
	ora_commitoff($conn);
	
	func1();
	
	func1();
	
	$curs = ora_open($conn);
	ora_parse($curs, "SELECT 1 FROM dual");
	ora_exec($curs);
	ora_close($curs);

	ora_commit($conn);
	ora_logoff($conn);
?>

This results in:

Warning: Connection already closed for cursor index 138323132 in /home/alban/public_htdocs/test/nested_connections.php on line 28

Warning: Connection already closed for cursor index 138323132 in /home/alban/public_htdocs/test/nested_connections.php on line 29

Warning: 1 is not a valid Oracle-Connection resource in /home/alban/public_htdocs/test/nested_connections.php on line 32

Warning: 1 is not a valid Oracle-Connection resource in /home/alban/public_htdocs/test/nested_connections.php on line 33

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-08-17 01:39 UTC] kalowsky@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.


 [2002-08-19 10:27 UTC] alban dot hertroys at ddnh dot nl
That won't be quite possible.

I use the combination of this PHP-version (by now it's PHP4.05something) and Oracle at work. I am certain that I cannot persuade my colleagues to use an untested (= recent) version of PHP4.

It is very easy to test if you can reproduce this bug, if you have a recent version of PHP and Oracle available. But I haven't, so someone else'll have to try.

It's a bit easy to mark a bug-report as "bogus" just because it was submitted more than a year ago. You can do better than that, can't you?
 [2002-08-19 10:30 UTC] kalowsky@php.net
No, I can't do better than marking it bogus.  I don't have a copy of Oracle, nor is 4.0.5 the latest PHP.  There were massive changes to the code between 4.0 and 4.1, and then from 4.1 to 4.2.  There is no more work being done on the 4.0 branch, thus if you wish to have this bug fixed you need a newer version.
 [2002-08-19 10:52 UTC] thies@php.net
i'm almost sure this problem is still in the code. 
the workaround would be to have two different TNS names 
for the same database and use them in the ora_logon call. 
 
if you use oracle client > 8.0 you should be using the 
newer and more powerful oci*() interface to talk to your 
database (event < 8.0) and use ocinlogon to force 
transaction isolation. 
 
 [2002-08-19 11:07 UTC] alban dot hertroys at ddnh dot nl
It is really very easy to reproduce with the sample-code below. All you need to do is change the username/password, and off you go. Every Oracle database has a dual table.

I'm sure you, or some other PHP-developer knows people who meet the requirements to verify this. Maybe even one of you guys does.

You can hardly expect me to request my sysadmin to setup a box with PHP4.2 and Oracle, just because I need to verify a nested Oracle-connection bug that I reported more than a year ago. After all, I'm not the person who left this bug-report open that long. Be reasonable.

But the "won't fix" status is at least clear and I can live with it.

We don't use ora-connections anymore (except for some old projects that are still running) and oracle-connections are way too expensive to justify setting up multiple, anyway.

It's still a bug, but I think you're right in thinking that nobody will bother.

[I hope this reply won't put the status back to 'bogus', but there is no 'wont fix' status in the dropdown... In that case, sorry.]
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sun Dec 05 18:03:37 2021 UTC