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: -
From: RQuadling at GMail dot com Assigned:
Status: Open Package: SOAP related
PHP Version: 5.3.6 OS: Windows XP SP3
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: RQuadling at GMail dot com
New email:
PHP Version: OS:

 

 [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

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Thu Sep 19 14:01:29 2019 UTC