From 8e981cdf15111db2922e2a371936d1fcb2c7bd8f Mon Sep 17 00:00:00 2001 From: DevSoftTech Server Date: Sun, 29 Mar 2026 05:11:51 +0530 Subject: [PATCH] Fix CURLRequest constants compatibility for AI server calls --- app/Config/CURLRequest.php | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/Config/CURLRequest.php b/app/Config/CURLRequest.php index bc5947f..34940b4 100644 --- a/app/Config/CURLRequest.php +++ b/app/Config/CURLRequest.php @@ -17,10 +17,7 @@ class CURLRequest extends BaseConfig * * @see https://www.php.net/manual/en/curl.constants.php#constant.curl-lock-data-connect */ - public array $shareConnectionOptions = [ - CURL_LOCK_DATA_CONNECT, - CURL_LOCK_DATA_DNS, - ]; + public array $shareConnectionOptions = []; /** * -------------------------------------------------------------------------- @@ -33,4 +30,18 @@ class CURLRequest extends BaseConfig * It may cause an error request with unnecessary headers. */ public bool $shareOptions = false; + + public function __construct() + { + parent::__construct(); + + // Some cURL builds do not expose these constants; skip sharing in that case. + if (defined('CURL_LOCK_DATA_CONNECT')) { + $this->shareConnectionOptions[] = constant('CURL_LOCK_DATA_CONNECT'); + } + + if (defined('CURL_LOCK_DATA_DNS')) { + $this->shareConnectionOptions[] = constant('CURL_LOCK_DATA_DNS'); + } + } }