Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion helpers/ip_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ function getIpInformation($ip = '')
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (PHP_VERSION_ID < 80000) {
curl_close($curl);
}
if ($err) {
$response = "cURL Error #:" . $err;
}
Expand Down
4 changes: 3 additions & 1 deletion helpers/request_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ function sendSimpleGetRequest($url = '', $data = array(), $method = 'GET')
curl_setopt_array($curl, $options);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if (PHP_VERSION_ID < 80000) {
curl_close($curl);
}
if ($err) {
$message = "cURL Error #: " . $err;
if (function_exists('log_message')) {
Expand Down
4 changes: 2 additions & 2 deletions src/BaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
class BaseHelper
{
const VERSION = '1.7.0';
const LAST_MODIFIED = '2025-03-15';
const VERSION = '1.7.1';
const LAST_MODIFIED = '2026-05-17';
const PROJECT_NAME = 'CodeIgniter - Basic Helper';
const AUTHOR_NAME = 'Hung Nguyen';
const AUTHOR_FULL_NAME = 'Hung Nguyen';
Expand Down
2 changes: 1 addition & 1 deletion src/BasicCurl.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ public function reset()
*/
public function close()
{
if (is_resource($this->curl)) {
if (PHP_VERSION_ID < 80000) {
curl_close($this->curl);
}
return $this;
Expand Down
4 changes: 3 additions & 1 deletion src/SimpleCurl.php
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,9 @@ public function createCurl($url = null)

public function closeCurl()
{
curl_close($this->session);
if (PHP_VERSION_ID < 80000) {
curl_close($this->session);
}
}

public function getHttpStatus()
Expand Down
16 changes: 12 additions & 4 deletions src/SimpleElasticsearch.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ public function complexSearch(
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
}

curl_close($curl);
if (PHP_VERSION_ID < 80000) {
curl_close($curl);
}
if ($fullResponse === true) {
return self::fullDataResponse($response, $page, $limit, $error_msg, $httpCode);
}
Expand Down Expand Up @@ -205,7 +207,9 @@ public function filterSearch(
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
}

curl_close($curl);
if (PHP_VERSION_ID < 80000) {
curl_close($curl);
}
if ($fullResponse === true) {
return self::fullDataResponse($response, $page, $limit, $error_msg, $httpCode);
}
Expand Down Expand Up @@ -360,7 +364,9 @@ public function syncDataElasticsearch($data, $action, $id, $index)
if (curl_errno($curl)) {
$error_msg = curl_error($curl);
}
curl_close($curl);
if (PHP_VERSION_ID < 80000) {
curl_close($curl);
}

if (isset($error_msg)) {
// echo 'error sync :' . $id . '__:' . json_encode($error_msg) . 'id :' . $index . 'action :' . $action . PHP_EOL;
Expand Down Expand Up @@ -490,7 +496,9 @@ public static function createIndexElasticsearch($index, $listFields, $specialFie
if (curl_errno($curl)) {
$error_msg = curl_error($curl);
}
curl_close($curl);
if (PHP_VERSION_ID < 80000) {
curl_close($curl);
}

if (isset($error_msg)) {
// Log::info('error sync :' . $index . '__:' . json_encode($error_msg));
Expand Down
5 changes: 3 additions & 2 deletions src/SimpleParseOpenGraph.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ static public function fetch($URI)


$response = curl_exec($curl);

curl_close($curl);
if (PHP_VERSION_ID < 80000) {
curl_close($curl);
}

if (!empty($response)) {
return self::_parse($response);
Expand Down
4 changes: 3 additions & 1 deletion src/SimpleRequests.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ public function xmlRequest($url = '', $data = '', $timeout = 60)
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
curl_close($ch);
if (PHP_VERSION_ID < 80000) {
curl_close($ch);
}

if ($this->DEBUG === true) {
$this->logger->info('Response from Request: ' . $response);
Expand Down
4 changes: 3 additions & 1 deletion src/SimpleRestful.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ public static function execute($url, $type, $data = "", $header = null)
$err = curl_error($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);

curl_close($curl);
if (PHP_VERSION_ID < 80000) {
curl_close($curl);
}

if ($err) {
echo "cURL Error #:" . $err;
Expand Down
Loading