[php-src] PR #22771: ext/soap: truncate a user_agent containing newline characters

From: Date: Thu, 16 Jul 2026 17:59:03 +0000
Subject: [php-src] PR #22771: ext/soap: truncate a user_agent containing newline characters
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-37103@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/22771 Author: iliaal GH-17976 (php/php-src#21658) sanitized user_agent where the HTTP wrapper emits headers and left the SOAP client alone, so CRLF in the value still injects request headers. Verified against a mock server on master: ini_set('user_agent', "ua\r\nX-Injected: yes") puts a real X-Injected: yes on the wire. A NUL-prefixed value ("ua\0valid\r\n...") injects too now that 21658 made the ini global a zend_string, where the old char* form truncated at the NUL. Three sources feed that sink unchecked (the SoapClient user_agent option, the http.user_agent context option, and the ini), so this resolves them to one zend_string and emits through the same truncate-and-warn check the HTTP wrapper uses. The two user-zval sources were already length-aware and injected before 21658, so 8.4 and 8.5 are affected as well. The helper mirrors smart_str_append_header_value() rather than exporting it from ext/standard, which would add API surface there for a soap fix; the duplication keeps behaviour identical for the same ini across both clients.

« previous php.git-pulls (#37103) next »