-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redundant sources causing redeclaration error #6
Comments
@koalamer thanks for reporting. I'll check this issue tomorrow, I'll try to provide a fix by then. |
@koalamer Sorry for the delay. Have been away from my web development environment for a while. You're right, in fact, I had my Have you tried to edit |
As far as I can remember I did try it and it did help. But then I decided not to modify any vendor files that could be overwritten by an update, so I just use this workaround: I create an empty nusoap instance before the wsdl_cache so that the classloader loads nusoap.php first, and then everything works fine. |
@koalamer Hello, Can you explain to me how do you fix the bug please ? I have the same error : PHP Fatal error: Cannot redeclare class nusoap_client in /space/www/xxx/data/htdocs/capifony/releases/20140505175343/vendor/nusphere/nusoap/lib/class.soapclient.php on line 26 |
@Hakadel: Just create a dummy client with a null parameter in it's constructor before you try to create the wsdlcache. |
Ok thank you :) |
@koalamer: Hello, Could you post an example code of your solution please? |
I solved the class duplication like this: // this first line is the workaround that causes the right nusoap source file to load first $client = new \nusoap_client(null); // and then you can instantiate the wsdl cache and the client as you would normally do $cache = new \nusoap_wsdlcache($path, $expiry); ... $client = new \nusoap_client($wsdl); A useful tip if you plan to send many requests with the same client instance: $client->setDebugLevel(0); $client->clearDebug(); |
Thanks a lot!!! |
Hi folks, when will this be fixed in main repository? |
Hi @lucianobargmann, I have not taken a look at this in a while, I'll check if there is something I can do about the autoloading to avoid this error. Thanks for the reminder. |
Solutions: postal@b8f7ba8 |
Hi all, can you retest with 0.2.0 or latest dev-master? Thanks. |
@noisebleed it works let's close this 👍 |
@noisebleed this bundle is actually useless, why not just use "fergusean/nusoap": "0.9.5" directly? |
When trying to use wsdlcache in symfony as described in the example wsdlclient12.php of the distribution, I get a redeclaration error.
The source code of this example creates instances of these classes, in this order:
wsdlcache, wsdl, nusoap_client
The autoload_classmap.php generated by composer contains these entries for them:
'wsdlcache' => $vendorDir . '/nusphere/nusoap/lib/class.wsdlcache.php',
'wsdl' => $vendorDir . '/nusphere/nusoap/lib/class.wsdl.php',
'nusoap_client' => $vendorDir . '/nusphere/nusoap/lib/nusoap.php'
The problem is that the declaration of the wsdl class is present in both class.wsdl.php and nusoap.php.
I guess, either nusoap.php should require_once those class declarations that are present in other lib files (instead of carrying a copy of them), or the classmap should map classes that are present in nusoap.php directly to nusoap.php, and not the separate class files.
The text was updated successfully, but these errors were encountered: