ID:               36034
 Updated by:       [EMAIL PROTECTED]
 Reported By:      ian_c_web at thejolly dot demon dot co dot uk
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: NetBSD
 PHP Version:      5.1.2
 New Comment:

The engine doesn't know about "result sets" and "database objects", all
it knows is that they are objects and they should be destroyed, so it's
your responsibility to call resultset destructors before database
destructors.
No bug here, this is expected behaviour.


Previous Comments:
------------------------------------------------------------------------

[2006-01-16 17:18:47] ian_c_web at thejolly dot demon dot co dot uk

Description:
------------
I have a class that abstracts a database connection, which returns a
'recordset' class for certain operations.

The destructor of the recordset class calls the necessary free
functions, which were issuing a 'warning: connection closed', which
turned out to be related to the database object going out of scope
first, and having it's destructor called. So I added a pointer to the
database in the recordset, thinking this would keep the database in
scope until the recordset was destroyed, but this did not seem to work.


If I assigned the recordset to null (hence forcing destruction)
everything works as required.

I think this is a scoping issue within PHP itself, as it seems to be
calling the destructor on the db object too early, although it doesn't
seem to actually be destroying the object. (I can still refer to public
variables within the object.)

Reproduce code:
---------------
http://thejolly.demon.co.uk/~ian/phptest.php.txt

Expected result:
----------------
SpecificApp construct.
Application construct.
Database construct. (test: 5)
ResultSet construct.
ResultSet destruct. 
Database destruct. (test: 34)
Application destruct.


Actual result:
--------------
SpecificApp construct.
Application construct.
Database construct. (test: 5)
ResultSet construct.
Application destruct.
Database destruct. (test: 34)
ResultSet destruct. 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36034&edit=1

Reply via email to