[php-src] Issue #9989: Why does curl_setopt_array break requests and curl_setopt doesn't when implemente Sophos Firewall?

From: Date: Tue, 22 Nov 2022 15:58:06 +0000
Subject: [php-src] Issue #9989: Why does curl_setopt_array break requests and curl_setopt doesn't when implemente Sophos Firewall?
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-242872@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/9989 Author: arcanisgk ### Description when i try to make a request implementing curl_setopt_array it doesn't work and sophos returns an error: ```php <?php try { $url = 'http://127.0.0.1/index.php'; $fields = array( 'JsonData'=>json_encode(['test' => 'test']) ); $postvars = http_build_query($fields); $options = [ CURLOPT_URL => $url, CURLOPT_POST => count($fields), CURLOPT_POSTFIELDS => $postvars, CURLOPT_TIMEOUT => 2, CURLOPT_RETURNTRANSFER => false, CURLOPT_FORBID_REUSE => true, CURLOPT_CONNECTTIMEOUT => 2, CURLOPT_DNS_CACHE_TIMEOUT => 10, CURLOPT_FRESH_CONNECT => true, CURLOPT_HTTPHEADER => array('Connection: close') ]; $ch = curl_init(); curl_setopt_array($ch, $options); curl_exec($ch); curl_close($ch); echo 'Finish!!!' } catch (Exception $e) { echo $e->getMessage(); } ``` note: curl_setopt_array return true but, when perform the curl_exec my sophos firewall return error: > Error: Content could not be delivered fue to the folloeing condition: Invalid argument when i tried to make a request by implementing curl_setopt works correctly and not get a sophos interruption: ```php <?php try { $url = 'http://127.0.0.1/index.php'; $fields = array( 'JsonData'=>json_encode(['test' => 'test']) ); $postvars = http_build_query($fields); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS, $postvars); curl_setopt($ch, CURLOPT_TIMEOUT, 2); curl_setopt($ch, CURLOPT_RETURNTRANSFER, false); curl_setopt($ch, CURLOPT_FORBID_REUSE, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2); curl_setopt($ch, CURLOPT_DNS_CACHE_TIMEOUT, 10); curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close')); curl_exec($ch); curl_close($ch); echo 'Finish!!!' } catch (Exception $e) { echo $e->getMessage(); } ``` - **Why the second works correctly and the first does not work? From my point of view I'm doing the same...** - I've already done it; and it is sophos that tells me that there is something wrong in the request between one option and the other. - if both work correctly; I don't understand what differences sophos detects to say that the option implemented by curl_setopt_array is malicious or there are invalid arguments; sophos does not alter anything... ### PHP Version php 7.4 ### Operating System Ubuntu 20.04

« previous php.bugs (#242872) next »