Post by cepcemuh » Tue Aug 27, 2024 9:21 pm

Hi all,
today after update to 3.0.4.0 in the Admin --> Extensions --> Modules I got this warning:
Warning: curl_getinfo(): supplied resource is not a valid cURL handle resource in /admin/controller/extension/extension/promotion.php on line 17
How to fix it? Thanks.

New member

Posts

Joined
Sat Jan 21, 2017 5:15 pm

Post by JNeuhoff » Tue Aug 27, 2024 10:04 pm

Try this bugfix.

Or make sure you use a correct OpenCart API setting in your admin/config/php :

Code: Select all

// OpenCart API
define('OPENCART_SERVER', 'https://www.opencart.com/');

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am


Post by Daylize » Sat Sep 07, 2024 8:12 am

The issue occurs because you're calling curl_getinfo($curl, CURLINFO_HTTP_CODE) after curl_close($curl), which invalidates the cURL resource.

Problematic line:

Code: Select all

 curl_close($curl); // Closing the cURL if ($response && curl_getinfo($curl, CURLINFO_HTTP_CODE) === 200) { // Invalid resource after close 
Corrected code:
Move the curl_getinfo() call before curl_close(). Here’s the corrected version:

Code: Select all

 $response = curl_exec($curl); $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE); // Call before closing the cURL curl_close($curl);

if ($response && $http_code === 200) { // Now using the valid HTTP code return $response; } else { return ''; } 
This ensures that the cURL handle is still valid when retrieving the HTTP code.

Newbie

Posts

Joined
Wed May 29, 2024 7:39 pm

Post by plutonium78 » Fri Jan 03, 2025 11:54 pm

Why does this error occurs on new installation of 3.0.4.0? It seems strange to release a new version with an immediate error.

Or is this due to PHP version?

I am using 7.3

Newbie

Posts

Joined
Thu Jun 01, 2023 10:27 pm

Post by JNeuhoff » Sat Jan 04, 2025 1:21 am

You need at least PHP version 7.4, or better, one of 8.x versions.

Export/Import Tool * SpamBot Buster * Unused Images Manager * Instant Option Price Calculator * Number Option * Google Tag Manager * Survey Plus * OpenTwig


User avatar
Guru Member

Posts

Joined
Wed Dec 05, 2007 3:38 am

Who is online

Users browsing this forum: Bing [Bot] and 3 guests