|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-02-22 19:43 UTC] 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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 00:00:01 2025 UTC |
You need to define the namespace in the classmap.. eg. private static $classmap = array( 'foo' => 'Other\foo', 'bar' => 'Other\bar' );