[php-src] Issue #10097: curl_setopt_array doesn't apply CURLOPT_RETURNTRANSFER.

From: Date: Tue, 13 Dec 2022 18:32:05 +0000
Subject: [php-src] Issue #10097: curl_setopt_array doesn't apply CURLOPT_RETURNTRANSFER.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-243133@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/10097 Author: 0xearl ### Description The following code: When using curl_setopt_array to set CURLOPT_RETURNTRANSFER it returns the result and bool. I was able to fix this by adding `curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);` ```php <?php $ch = curl_init(); $options = [CURLOPT_URL => 'https://google.com', CURLOPT_TCP_FASTOPEN => true, CURLOPT_TRANSFERTEXT => false, CURLOPT_RETURNTRANSFER => true]; curl_setopt_array($ch, $options); $res = curl_exec($ch); curl_close($ch); var_dump($res); ``` Resulted in this output: ``` <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>301 Moved</TITLE></HEAD><BODY> <H1>301 Moved</H1> The document has moved <A HREF="https://www.google.com/">here</A>. </BODY></HTML> bool(true) ``` But I expected this output instead: ``` <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8"> <TITLE>301 Moved</TITLE></HEAD><BODY> <H1>301 Moved</H1> The document has moved <A HREF="https://www.google.com/">here</A>. </BODY></HTML> ``` ### PHP Version 8.1.6 & 8.1.12 ### Operating System Windows 10

« previous php.bugs (#243133) next »