Bug #54792 [NEW]: Constructor not called, but destructor is.
| From: | RQuadling at GMail dot com | Date: | Tue, 17 May 2011 13:19:03 +0000 |
| Subject: | Bug #54792 [NEW]: Constructor not called, but destructor is. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-160786@lists.php.net to get a copy of this message | ||
From:
Operating system: Windows XP SP3
PHP version: 5.3.6
Package: SOAP related
Bug Type: Bug
Bug description:Constructor not called, but destructor is.
Description:
------------
When using SOAPClient with WSDL types as PHP classes, you define the
relationship in the classmap element of the options parameter to the
SoapClient
constructor.
The instances that are created by the SOAPClient do not call the
constructor,
but, once created, the destructor is called as part of the script
shutdown.
I don't know if this is a bug in SOAPClient in that it SHOULD call the
constructors, or just a documentation issue in that the lack of
construction is
not documented.
If a PHP class with methods is used in the class map, the class is
instantiated
and you can call the methods, so it looks just like a normal class/object.
But
with no constructor.
When the script closes, the destructors are called.
My test script is fairly large as there are 14 magic methods to add to the
classes.
So, it is available at http://pastebin.com/4CWHrwKq
Test script:
---------------
http://pastebin.com/4CWHrwKq
Expected result:
----------------
ConversionRate::__construct ( a:0:{} )
ConversionRateResponse::__contruct ( a:0:{} )
0.6171
ConversionRateResponse::__destruct ( a:0:{} )
ConversionRate::__destruct ( a:0:{} )
Actual result:
--------------
ConversionRate::__construct ( a:0:{} )
0.6171
ConversionRateResponse::__destruct ( a:0:{} )
ConversionRate::__destruct ( a:0:{} )
--
Edit bug report at http://bugs.php.net/bug.php?id=54792&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54792&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54792&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54792&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54792&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54792&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54792&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54792&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54792&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54792&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54792&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54792&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54792&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54792&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54792&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54792&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54792&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54792&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54792&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54792&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54792&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54792&r=mysqlcfg