From 6519d3682ad2c5b0d37474a582970516b7931980 Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 18 Jun 2013 11:31:29 +0200 Subject: [PATCH] [-] CORE : Report of https://github.com/PrestaShop/PrestaShop/pull/504 Thanks @aseques --- classes/Tools.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/classes/Tools.php b/classes/Tools.php index 39027ed14..3a80f749b 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1303,14 +1303,16 @@ class ToolsCore curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 5); curl_setopt($curl, CURLOPT_TIMEOUT, $curl_timeout); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); - $opts = stream_context_get_options($stream_context); - if (isset($opts['http']['method']) && Tools::strtolower($opts['http']['method']) == 'post') - { - curl_setopt($curl, CURLOPT_POST, true); - if (isset($opts['http']['content'])) + if ($stream_context != null) { + $opts = stream_context_get_options($stream_context); + if (isset($opts['http']['method']) && Tools::strtolower($opts['http']['method']) == 'post') { - parse_str($opts['http']['content'], $datas); - curl_setopt($curl, CURLOPT_POSTFIELDS, $datas); + curl_setopt($curl, CURLOPT_POST, true); + if (isset($opts['http']['content'])) + { + parse_str($opts['http']['content'], $datas); + curl_setopt($curl, CURLOPT_POSTFIELDS, $datas); + } } } $content = curl_exec($curl);