Edit report at https://bugs.php.net/bug.php?id=54684&edit=1
ID: 54684
Comment by: henning dot panke at erento dot com
Reported by: luke at cywh dot com
Summary: SoapServer->handle() breaks type hinting
Status: Open
Type: Bug
Package: SOAP related
Operating System: Mac OS X 10.6
PHP Version: 5.3.6
Block user comment: N
Private report: N
New Comment:
Can reproduce this issue on a gentoo system with php 5.2.17.
Previous Comments:
------------------------------------------------------------------------
[2011-05-07 02:55:44] luke at cywh dot com
Description:
------------
SoapServer's handle() function breaks PHPs type-hinting for function parameters.
Note that if you remove "$server->handle()" you get the expected result. If you
leave it there you get the actual result.
If this is intended it might have to do with SoapServer passing back stdClass
as function arguments. But please note that this test code is not even used by
SoapServer. I merely call the handle() function and every function call is
effected, not just those invoked by SoapServer. Also for functions invoked by
SoapServer, shouldn't a string fail because it's a non-object?
If this isn't going to be fixed because it's a "feature" then we have a
documentation problem. There needs to be a warning on the handle()
documentation that states type-hinting is broken globally.
If this was intended, I honestly don't think this should happen on a global
scope. Only functions called by SoapServer should be effected, and even then
the type should be at least restricted to an object.
Test script:
---------------
$server = new \SoapServer(NULL, array('uri' => 'http://localhost'));
$server->handle();
class test
{
public function sayHello(Blah $one, $two)
{
return $one;
}
}
$test = new test;
var_dump($test->sayHello('one', 'two'));
Expected result:
----------------
Catchable fatal error: Argument 1 passed to test::sayHello() must be an
instance of Blah, string given
Actual result:
--------------
string(3) "one"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54684&edit=1