1

How to properly introduce the curl extension as a dependency?

Simply trying to create an array that references constants from the curl extension like so

public function __construct()
{
    let this->options = [
        CURLOPT_SSL_VERIFYPEER : false,
        CURLOPT_RETURNTRANSFER : true,
        CURLOPT_CONNECTTIMEOUT : 30,
        CURLOPT_TIMEOUT        : 30
    ];
}

causes compile time warnings / errors

Warning: Constant 'CURLOPT_CONNECTTIMEOUT' does not exist at compile time in /home/nathan/gitRepos/zephir/rcurl/rcurl/curl.zep on 89 [nonexistent-constant]

          CURLOPT_CONNECTTIMEOUT : "30",  -----------------------------------^

Zephir\CompilerException: Invalid value type: string in /home/nathan/gitRepos/zephir/rcurl/rcurl/curl.zep on line 89

          CURLOPT_CONNECTTIMEOUT : "30",  -----------------------------------------^

I started looking in the generated config.json file and found a requires section to which I added curl so it now looks like this

"requires": {
    "extensions": [
        "curl"
    ]   
},

However now the compiler errors have changed

Zephir\Exception: Could not load extension : curl, You must add extensions above before build this extension

apaderno
  • 28,547
  • 16
  • 75
  • 90
quickshiftin
  • 66,362
  • 10
  • 68
  • 89
  • Weird, I installed the extension via `apt-get` and now it works even without the config.json revision. Strange that had any impact, considering the apt package is binary... – quickshiftin Dec 21 '16 at 22:46

0 Answers0