1

I'm using kriswallsmith/Buzz browser inside my custom service Skebby. Here is config.yml, please note the call to setVerifyPeer(false) to disable SSL certificate verification:

# cURL client
buzz.client.curl:
    class:  Buzz\Client\Curl
    public: false
    calls:
    - [setVerifyPeer, [false]]

# Buzz browser configured to use cURL client
buzz.browser:
    class:     Buzz\Browser
    arguments: ['@buzz.client.curl']

While Skebby itself is annotated with schmittjoh/JMSDiExtraBundle:

/** @Service("skebby") */
Class Skebby
{
    /**
     * @InjectParams({
     *     "browser"    = @Inject("buzz.browser"),
     *     "translator" = @Inject("translator")
     * })
     *
     * @param \Buzz\Browser $browser
     * @param \Symfony\Bundle\FrameworkBundle\Translation\Translator $translator
     */
    public function __construct(Browser $browser, Translator $translator)
    {
        $this->browser    = $browser;
        $this->translator = $translator;
    }

    public function getCredit()
    {
        var_dump($this->browser->getClient());
        die();
    }
}

Unfortunately the call (inside a controller) $this->get('skebby')->getCredit() shows that something wrong happened with the service container:

object(Buzz\Client\Curl)[4905]
  private 'lastCurl' => null
  protected 'options' => 
    array (size=0)
      empty
  protected 'ignoreErrors' => boolean true
  protected 'maxRedirects' => int 5
  protected 'timeout' => int 5
  protected 'verifyPeer' => boolean true

That is verifyPeer is still true, as the call setVerifyPeer(false) never happened. Is there something wrong with my configuration?

Useful links:

Elnur Abdurrakhimov
  • 44,533
  • 10
  • 148
  • 133
gremo
  • 47,186
  • 75
  • 257
  • 421

1 Answers1

2

You have wrong indentation under calls directive

Should be:

buzz.client.curl:
    class:  Buzz\Client\Curl
    public: false
    calls:
        - [setVerifyPeer, [false]]

In your version it calls nothing ;)

Vitalii Zurian
  • 17,858
  • 4
  • 64
  • 81