Bug #54074 [Com]: SoapClient classmap ignores currently set namespace
Edit report at https://bugs.php.net/bug.php?id=54074&edit=1
ID: 54074
Comment by: info at cyclical dot ca
Reported by: php at jcald dot com
Summary: SoapClient classmap ignores currently set namespace
Status: Open
Type: Bug
Package: SOAP related
Operating System: Linux 2.6.18-194 (Centos 5.5)
PHP Version: 5.3.5
Block user comment: N
Private report: N
New Comment:
This issue is still present in php 5.5 and is confirmed. The workaround is to always specify a full
namespace starting from the root \. Unfortunately this can get pretty verbose.
Previous Comments:
------------------------------------------------------------------------
[2012-04-12 00:55:06] me at jacobt dot com
You need to define the namespace in the classmap.. eg.
private static $classmap = array(
'foo' => 'Other\foo',
'bar' => 'Other\bar'
);
------------------------------------------------------------------------
[2011-02-22 19:43:23] php at jcald dot com
Description:
------------
When a class extending SoapClient is defined in a namespace, the classmap ignores the current
namespace and maps classes directly to the global namespace. In order for it to function correctly,
the classmap must include the "fully qualified" namespace\classname as the target.
Currently, I'm using a wrapper class for SoapClient that prepends __NAMESPACE__ onto the
classmap entries to get around this issue.
Test script:
---------------
// This is NOT a fully complete test script, since it requires testing against an actual SOAP server
to function. Plus I couldn't fit that in 20 lines.
//Does not work:
namespace Other;
class OtherService extends \SoapClient {
private static $classmap = array(
'session' => 'session',
'foo' => 'foo'
);
// etc etc
}
//Works:
namespace Other;
class OtherService extends \SoapClient {
private static $classmap = array(
'session' => 'Other\session',
'foo' => 'Other\foo'
);
// etc etc
}
Expected result:
----------------
The classmap would obey the current namespace.
Actual result:
--------------
PHP Fatal error: Class 'session' not found in test.php on line XX
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=54074&edit=1
Thread (4 messages)