Re: [PHP-DEV] Disallow newlines in CURLOPT_HTTPHEADER

[email protected] (Tim Düsterhus) Tue, 14 Jul 2026 10:13:33 +0200
Newsgroups php.internals
Message-ID <[email protected]>
Hi

On 2026-07-13 20:32, Sjoerd Langkemper wrote:
> Interesting, thanks. That PR adds a check for newlines in curl. So that 
> makes it clear that headers are really not supposed to have newlines. 
> But if curl checks this perhaps a check in PHP is not really adding 
> anything. It could offer better error messages, and include the check 
> even when someone is using an older curl. Would it still be valuable to 
> include the newline check in PHP?

It will be a while until that cURL version makes it into the various 
operating systems. Including an extra check in PHP for improved error 
messages and consistent behavior makes sense to me, it's not uncommon to 
run newer PHP versions on older OS versions (e.g. within Docker).

Best regards
Tim Düsterhus