Bug #45155 [Com]: Constructors not called when using classmap option in SoapClient

From: Date: Fri, 16 Nov 2012 10:40:48 +0000
Subject: Bug #45155 [Com]: Constructors not called when using classmap option in SoapClient
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-174759@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=45155&edit=1

 ID:                 45155
 Comment by:         miceleparkip at web dot de
 Reported by:        david at globulebleu dot com
 Summary:            Constructors not called when using classmap option
                     in SoapClient
 Status:             Open
 Type:               Bug
 Package:            SOAP related
 Operating System:   *
 PHP Version:        5.2.6
 Block user comment: N
 Private report:     N

 New Comment:

This is not a bug. It's quite normal.

The soap object is created on the server side. So the constructor is just called on the server.
Note: This is not a technical question - the programmers of Soap-PHP just couldn't implement
it. It's against the principle of webserivces.

Logical on the client no __construct neither __wakeup is called.
On the other hand no __destruct neither __sleep is called on the server - but on the client.


If you want to initialize some data after receiving the soap object, you have to use a conventional
function.
"webservice objects" are NEVER created on the client side!


Previous Comments:
------------------------------------------------------------------------
[2012-05-03 13:09:10] andyidol at gmail dot com

Same here with 5.3.10. Maybe such classes should implement some specific 
interface (to avoid situation when class constructor has some required 
arguments) and to add some extra functionality, e.g:

<?php

interface SoapResult {
  public function __construct();
  public function afterDeserialize();
}

?>

------------------------------------------------------------------------
[2011-05-04 18:22:02] kissifrot at gmail dot com

Same problems happens with PHP 5.3.6 (dotdeb version) on Lenny.

This is quite annoying as we cannot later call the created object's methods due to some logic
done in the constructor (such as sanitizing for instance) which is missing.

------------------------------------------------------------------------
[2010-05-04 18:10:39] philipp dot kempgen at amooma dot de

Same thing applies to SoapServer as well.

------------------------------------------------------------------------
[2010-05-04 18:03:36] philipp dot kempgen at amooma dot de

Bug still found in PHP 5.3.2.

------------------------------------------------------------------------
[2009-10-29 14:20:32] grzegorz dot drozd at esky dot pl

__wakeup is not called before deserialization from session (if you store object in session of
course). Only __set is called when setting properties.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=45155


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


Thread (13 messages)

« previous php.bugs (#174759) next »