问题描述
使用与 symfony2
的Payum捆绑包,我有共同的
无法验证ssl证书
错误。
Using the Payum bundle with symfony2
, I have the commonunable to verify ssl certificate
error.
我无法通过改变 php中的
或通过在我的PHP代码中设置 curl
选项来摆脱它。 ini curl
选项。
I couldn't get rid of it by changing curl
options in php.ini
or by setting curl
options in my php code.
vendor / kriswallsmith / buzz / lib / Buzz / Client / AbstractClient.php
类并设置默认的 $ verifyPeer
选项 false
最后允许我使用wamp在本地使用Payum和PayPal快速结帐。
However, modifying the vendor/kriswallsmith/buzz/lib/Buzz/Client/AbstractClient.php
class and setting the default $verifyPeer
option to false
finally allows me to use Payum and PayPal express checkout locally with wamp.
编辑:
也可以重写这个使用另一个类的类。我觉得更安全:
I can also override this class which uses the other one. I feel it's safer:
我如何覆盖这个类(理想情况下,当我在本地工作时在开发模式下)?
How can I override this class (ideally conditionally ie in dev mode when I'm working locally) ?
推荐答案
您可以覆盖服务 payum.buzz.client
。只需在您的捆绑中定义它,它是在PayumBundle之后注册的。
You can overwrite the service payum.buzz.client
. Just define it in your bundle which is registered after PayumBundle.
<service id="payum.buzz.client" class="Buzz\Client\ClientInterface" factory-class="Payum\Core\Bridge\Buzz\ClientFactory" factory- method="createCurl">
<call method="setVerifyPeer">
<argument>false</argument>
</call>
</service>
或yml
services:
payum.buzz.client:
class: Buzz\Client\ClientInterface
factory_class: Payum\Core\Bridge\Buzz\ClientFactory
factory_method: createCurl
calls:
- [setVerifyPeer, [false]]
这篇关于重载symfony2供应商类以将curl verify_peer选项设置为false的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!