Remove unused variable in MultiHttpClient CURLOPT_READFUNCTION callback
authorAaron Schulz <aschulz@wikimedia.org>
Sun, 1 Sep 2019 16:57:51 +0000 (09:57 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Tue, 3 Sep 2019 06:12:21 +0000 (06:12 +0000)
Also make sure the result is a string as is required

Change-Id: I90107efd8f253aebc9b83fc2272aedf65ba161ba

includes/libs/http/MultiHttpClient.php

index 6b1ef89..17352f0 100644 (file)
@@ -353,9 +353,7 @@ class MultiHttpClient implements LoggerAwareInterface {
                        }
                        curl_setopt( $ch, CURLOPT_READFUNCTION,
                                function ( $ch, $fd, $length ) {
-                                       $data = fread( $fd, $length );
-                                       $len = strlen( $data );
-                                       return $data;
+                                       return (string)fread( $fd, $length );
                                }
                        );
                } elseif ( $req['method'] === 'POST' ) {