2222use WpOrg \Requests \Transport \Curl ;
2323use WpOrg \Requests \Transport \Fsockopen ;
2424use WpOrg \Requests \Utility \InputValidator ;
25+ use WpOrg \Requests \Utility \Trim ;
2526
2627/**
2728 * Requests for PHP
@@ -762,7 +763,7 @@ protected static function parse_response($headers, $url, $req_headers, $req_data
762763
763764 foreach ($ headers as $ header ) {
764765 list ($ key , $ value ) = explode (': ' , $ header , 2 );
765- $ value = trim ($ value );
766+ $ value = trim ($ value, Trim:: WHITESPACE_CHARS_NO_FF );
766767 preg_replace ('#(\s+)#i ' , ' ' , $ value );
767768 $ return ->headers [$ key ] = $ value ;
768769 }
@@ -851,7 +852,7 @@ public static function parse_multiple(&$response, $request) {
851852 * @return string Decoded body
852853 */
853854 protected static function decode_chunked ($ data ) {
854- if (!preg_match ('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i ' , trim ($ data ))) {
855+ if (!preg_match ('/^([0-9a-f]+)(?:;(?:[\w-]*)(?:=(?:(?:[\w-]*)*|"(?:[^\r\n])*"))?)*\r\n/i ' , trim ($ data, Trim:: WHITESPACE_CHARS_NO_FF ))) {
855856 return $ data ;
856857 }
857858
@@ -865,7 +866,7 @@ protected static function decode_chunked($data) {
865866 return $ data ;
866867 }
867868
868- $ length = hexdec (trim ($ matches [1 ]));
869+ $ length = hexdec (trim ($ matches [1 ], Trim:: WHITESPACE_CHARS_NO_FF ));
869870 if ($ length === 0 ) {
870871 // Ignore trailer headers
871872 return $ decoded ;
@@ -875,7 +876,7 @@ protected static function decode_chunked($data) {
875876 $ decoded .= substr ($ encoded , $ chunk_length , $ length );
876877 $ encoded = substr ($ encoded , $ chunk_length + $ length + 2 );
877878
878- if (trim ($ encoded ) === '0 ' || empty ($ encoded )) {
879+ if (trim ($ encoded, Trim:: WHITESPACE_CHARS_NO_FF ) === '0 ' || empty ($ encoded )) {
879880 return $ decoded ;
880881 }
881882 }
@@ -922,7 +923,7 @@ public static function decompress($data) {
922923 throw InvalidArgument::create (1 , '$data ' , 'string ' , gettype ($ data ));
923924 }
924925
925- if (trim ($ data ) === '' ) {
926+ if (trim ($ data, Trim:: WHITESPACE_CHARS_NO_FF ) === '' ) {
926927 // Empty body does not need further processing.
927928 return $ data ;
928929 }
@@ -989,7 +990,7 @@ public static function compatible_gzinflate($gz_data) {
989990 throw InvalidArgument::create (1 , '$gz_data ' , 'string ' , gettype ($ gz_data ));
990991 }
991992
992- if (trim ($ gz_data ) === '' ) {
993+ if (trim ($ gz_data, Trim:: WHITESPACE_CHARS_NO_FF ) === '' ) {
993994 return false ;
994995 }
995996
0 commit comments