php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #54792 Constructor not called, but destructor is.
Submitted: 2011-05-17 15:19 UTC Modified: 2021-08-27 09:43 UTC
From: RQuadling at GMail dot com Assigned: cmb (profile)
Status: Duplicate Package: SOAP related
PHP Version: 5.3.6 OS: Windows XP SP3
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:
8 + 12 = ?
Subscribe to this entry?

 
 [2011-05-17 15:19 UTC] RQuadling at GMail dot com
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:{} )

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-08-27 09:43 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2021-08-27 09:43 UTC] cmb@php.net
The link test script is no longer available, but this is a
duplicate of bug #45155 anyway.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 13:01:29 2024 UTC