Bug #52393 [NEW]: __destructor of parameter object called on return
From:
Operating system: Fedora 13
PHP version: 5.3.2
Package: Class/Object related
Bug Type: Bug
Bug description:__destructor of parameter object called on return
Description:
------------
The situation is as following:
class mysqlControl holds a MySQL connection. This class has a __destruct()
method to close this connection properly
Class x has one of these mysqlControl objects as a private variable.
Class y has a method to represent itself in a MySQL way, and needs to
escape a string. For this it needs the mysqlControl that class X holds.
Now what happens is that Class x calls Class y's method to represent itself
in some form that's useful to query MySQL. As a parameter to y's method X
gives it's mysqlControl. Before y's method actually starts executing,
mysqlControl's destructor is called. This means the connection is closed,
and everything breaks.
Expected result:
----------------
I expected method y to not call mysqlControl's destructor but just uses the
mysqlControl given and forgets about it.
Actual result:
--------------
mysqlControl's destructor gets called, breaking the
mysql_real_escape_string() method before it could be used by class Y's
method.
--
Edit bug report at http://bugs.php.net/bug.php?id=52393&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52393&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52393&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52393&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52393&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52393&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52393&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52393&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52393&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52393&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52393&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52393&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52393&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52393&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52393&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52393&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52393&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52393&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52393&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52393&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52393&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52393&r=mysqlcfg
Thread (3 messages)
- r dot spliet at student dot tudelft dot nl