Error: curl_setopt_array(): supplied resource is not a valid cURL handle resource
Input:
countries
array:6 [
0 => "sve"
1 => "nld"
2 => "lvi"
3 => "lth"
4 => "eti"
5 => "hrv"
]
date_from
"01.09.2018"
date_to
"30.09.2018"
I am just iterating through the countries and call retrieveData method.
It's crashes after he wrote json to the file, on return $data
. I ran more then 10 times. And sometimes he managed to write only 1 file (sve), sometimes 2 (sve, nld) and once he wrote 3...
It's very strange problem.
Stack trace:
Elasticsearch\Helper\Iterators\SearchResponseIterator __destruct
…\app\Managers\XXX\XXX.php
App\Managers\XXX\XXX retriveData
…\app\Http\Controllers\ManagersController.php
Managers controller:
foreach ($countries_to_retrieve as $country) {
$this->all_countries_data[$country] = XXX::retriveData($country, $request->date_from, $request->date_to);
}
XXX.php:
public static function retriveData($country, $from, $to): array {
...
if (!in_array($folder, Storage::directories())) {
Storage::makeDirectory($folder);
}
Storage::put($folder . '\\' . $country . $from . $to, json_encode($data));
return $data; <----- HERE is exception
}
Is there is ideas, how do I continue to investigate the issue?
P.S. forgot to say, that this maybe related to PHP version, our production is on 5.6, but now we are migrating to 5.7, and we are testing everything on 5.7. And this functionality is working on production, but on localhost we have such problem.