php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31817 magic method __call is being ignored in classes "exported" with setClass()
Submitted: 2005-02-02 16:40 UTC Modified: 2005-02-04 17:04 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: tschlottke at virtualminds dot de Assigned: dmitry (profile)
Status: Not a bug Package: SOAP related
PHP Version: 5.0.3 OS: debian unstable
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: tschlottke at virtualminds dot de
New email:
PHP Version: OS:

 

 [2005-02-02 16:40 UTC] tschlottke at virtualminds dot de
Description:
------------
PHP 5's magic __call() method is being ignored in classes  
exported via soap.  
It's being ignored completly, afais. 
IMHO it should be called. 

Reproduce code:
---------------
<?php
class test {
    function __call($func,$args) {
        return 'this is __call()';
    }
    function test(){
        return 'this is test()';
    }
}
$server = new SoapServer(null, array('uri' => "namespace"));
$server->setClass('test');
$server->handle();
?>
---
<?php
$client=new SoapClient(...);
echo $client->test();
?>

Expected result:
----------------
"this is __call" 

Actual result:
--------------
"this is test()"  

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-04 15:29 UTC] dmitry@php.net
It works as expected.
If you will call somthing different from "test" you will go into __call().
 [2005-02-04 15:42 UTC] tschlottke at virtualminds dot de
Yes, that's not what I ment.  
Sure, __call is being called if I call another method from  
within test() but __call should also be called if a not  
existing method is being called via soap, IMHO, you know  
what I mean?  
This is very useful if you want to wrap all soap calls and  
check the parameters, for example, so you can create  
completly virtual soap methods.  
In my case I use this to check if the session is valid.  
The user always has to send the session-id as the first 
parameter for each function and __call checks if 
everything is correct and calls all the target-method via 
call_user_function_array() or something.
 [2005-02-04 15:45 UTC] tschlottke at virtualminds dot de
or am I wrong and you ment that I should call another  
function but not test()?   
this isn't working in my php 5.0.3 installation and that's  
why i submitted the bug ;)
 [2005-02-04 16:53 UTC] dmitry@php.net
You are wrong. Try the following script:

<?php
class test {
    function __call($func,$args) {
        return 'this is __call()';
    }
    function test(){
        return 'this is test()';
    }
}
$x = new test;
echo $x->test();
?>
 [2005-02-04 17:04 UTC] tschlottke at virtualminds dot de
Yeah, but that's not my point ;)  
I want the Soap-Extension (the SoapServer) to call __call 
if it exists in a  
class "exported" via soapServer->setClass(...) if some 
soapclient calls a not existing function. 
I hope you'll understand me this time :)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 13:01:31 2024 UTC