On 16 February 2024 16:09:32 GMT, Rowan Tommins <rowan.coll...@gmail.com> wrote:

>public function executeAndReturn(): string
>public function executeAndOutput(): void

I guess I missed:

public function executeToFile(Stream $fileHandle): void
public function executeWithCallback(callable $wrIteFunction): void

which would imply CURLOPT_FILE and CURLOPT_WRITEFUNCTION, respectively.

From what I can see, these four modes are actually mutually exclusive 
(populating ch->handlers.write->method) with whichever option is touched last 
governing the actual behaviour of curl_exec(). For instance, setting 
CURLOPT_FILE to null or CURLOPT_RETURNTRANSFER to false always selects stdout 
mode, effectively clearing any value set with CURLOPT_WRITEFUNCTION. Having 
separate execute methods would make that much more obvious.

Incidentally, I notice there is currently some code in 
_php_curl_verify_handlers where a bad stream in CURLOPT_FILE will fall back to 
writing the result to stdout. Is it me, or is that a really terrible idea, 
potentially exposing private data to the user? Should that scenario be promoted 
to an immediate false return in curl_exec, and Error in the new OO wrapper?

Regards,

-- 
Rowan Tommins
[IMSoP]

Reply via email to