From:
Operating system: Mac OS X 10.6
PHP version: 5.3.6
Package: SOAP related
Bug Type: Bug
Bug description:SoapServer->handle() breaks type hinting
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 bug report at http://bugs.php.net/bug.php?id=54684&edit=1
--
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=54684&r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=54684&r=trysnapshot53
Try a snapshot (trunk):
http://bugs.php.net/fix.php?id=54684&r=trysnapshottrunk
Fixed in SVN:
http://bugs.php.net/fix.php?id=54684&r=fixed
Fixed in SVN and need be documented:
http://bugs.php.net/fix.php?id=54684&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=54684&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=54684&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=54684&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=54684&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=54684&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=54684&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=54684&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=54684&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=54684&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54684&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54684&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=54684&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=54684&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=54684&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=54684&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=54684&r=mysqlcfg