Index: trunk/phase3/maintenance/tests/phpunit/includes/HttpTest.php |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | function testInstantiation() { |
78 | 78 | Http::$httpEngine = false; |
79 | 79 | |
80 | | - $r = HttpRequest::factory( "http://www.example.com/" ); |
| 80 | + $r = MWHttpRequest::factory( "http://www.example.com/" ); |
81 | 81 | if ( self::$has_curl ) { |
82 | 82 | $this->assertThat( $r, $this->isInstanceOf( 'CurlHttpRequest' ) ); |
83 | 83 | } else { |
— | — | @@ -88,7 +88,7 @@ |
89 | 89 | $this->setExpectedException( 'MWException' ); |
90 | 90 | } |
91 | 91 | Http::$httpEngine = 'php'; |
92 | | - $r = HttpRequest::factory( "http://www.example.com/" ); |
| 92 | + $r = MWHttpRequest::factory( "http://www.example.com/" ); |
93 | 93 | $this->assertThat( $r, $this->isInstanceOf( 'PhpHttpRequest' ) ); |
94 | 94 | unset( $r ); |
95 | 95 | |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | $this->setExpectedException( 'MWException' ); |
98 | 98 | } |
99 | 99 | Http::$httpEngine = 'curl'; |
100 | | - $r = HttpRequest::factory( "http://www.example.com/" ); |
| 100 | + $r = MWHttpRequest::factory( "http://www.example.com/" ); |
101 | 101 | if ( self::$has_curl ) { |
102 | 102 | $this->assertThat( $r, $this->isInstanceOf( 'CurlHttpRequest' ) ); |
103 | 103 | } |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | $this->assertFalse( $r, "False on 404s" ); |
119 | 119 | |
120 | 120 | |
121 | | - $r = HttpRequest::factory( "http://www.example.com/this-file-does-not-exist" ); |
| 121 | + $r = MWHttpRequest::factory( "http://www.example.com/this-file-does-not-exist" ); |
122 | 122 | $er = $r->execute(); |
123 | 123 | if ( is_a( $r, 'PhpHttpRequest' ) && version_compare( '5.2.10', phpversion(), '>' ) ) { |
124 | 124 | $this->assertRegexp( "/HTTP request failed/", $er->getWikiText() ); |
— | — | @@ -532,7 +532,7 @@ |
533 | 533 | } |
534 | 534 | |
535 | 535 | function runCookieRequests() { |
536 | | - $r = HttpRequest::factory( "http://www.php.net/manual", array( 'followRedirects' => true ) ); |
| 536 | + $r = MWHttpRequest::factory( "http://www.php.net/manual", array( 'followRedirects' => true ) ); |
537 | 537 | $r->execute(); |
538 | 538 | |
539 | 539 | $jar = $r->getCookieJar(); |
Index: trunk/phase3/maintenance/tests/phpunit/includes/api/ApiTest.php |
— | — | @@ -171,7 +171,7 @@ |
172 | 172 | if ( !isset( $wgServer ) ) { |
173 | 173 | $this->markTestIncomplete( 'This test needs $wgServer to be set in LocalSettings.php' ); |
174 | 174 | } |
175 | | - $req = HttpRequest::factory( self::$apiUrl . "?action=login&format=xml", |
| 175 | + $req = MWHttpRequest::factory( self::$apiUrl . "?action=login&format=xml", |
176 | 176 | array( "method" => "POST", |
177 | 177 | "postData" => array( |
178 | 178 | "lgname" => self::$user->userName, |
— | — | @@ -214,7 +214,7 @@ |
215 | 215 | if ( $wgServer == "http://localhost" ) { |
216 | 216 | $this->markTestIncomplete( 'This test needs $wgServer to be set in LocalSettings.php' ); |
217 | 217 | } |
218 | | - $req = HttpRequest::factory( self::$apiUrl . "?action=query&format=xml&prop=revisions&" . |
| 218 | + $req = MWHttpRequest::factory( self::$apiUrl . "?action=query&format=xml&prop=revisions&" . |
219 | 219 | "titles=Main%20Page&rvprop=timestamp|user|comment|content" ); |
220 | 220 | $req->setCookieJar( $cj ); |
221 | 221 | $req->execute(); |
Index: trunk/phase3/includes/upload/UploadFromUrl.php |
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | /** |
102 | 102 | * Save the result of a HTTP request to the temporary file |
103 | 103 | * |
104 | | - * @param $req HttpRequest |
| 104 | + * @param $req MWHttpRequest |
105 | 105 | * @return Status |
106 | 106 | */ |
107 | 107 | private function saveTempFile( $req ) { |
— | — | @@ -120,7 +120,7 @@ |
121 | 121 | * size and set $mRemoveTempFile to true. |
122 | 122 | */ |
123 | 123 | protected function reallyFetchFile() { |
124 | | - $req = HttpRequest::factory( $this->mUrl ); |
| 124 | + $req = MWHttpRequest::factory( $this->mUrl ); |
125 | 125 | $status = $req->execute(); |
126 | 126 | |
127 | 127 | if ( !$status->isOk() ) { |
Index: trunk/phase3/includes/filerepo/ForeignAPIRepo.php |
— | — | @@ -362,7 +362,7 @@ |
363 | 363 | $options['timeout'] = 'default'; |
364 | 364 | } |
365 | 365 | |
366 | | - $req = HttpRequest::factory( $url, $options ); |
| 366 | + $req = MWHttpRequest::factory( $url, $options ); |
367 | 367 | $req->setUserAgent( ForeignAPIRepo::getUserAgent() ); |
368 | 368 | $status = $req->execute(); |
369 | 369 | |
Index: trunk/phase3/includes/AutoLoader.php |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | 'HTMLRadioField' => 'includes/HTMLForm.php', |
127 | 127 | 'HTMLInfoField' => 'includes/HTMLForm.php', |
128 | 128 | 'Http' => 'includes/HttpFunctions.php', |
129 | | - 'HttpRequest' => 'includes/HttpFunctions.php', |
| 129 | + 'HttpRequest' => 'includes/HttpFunctions.old.php', |
130 | 130 | 'ImageGallery' => 'includes/ImageGallery.php', |
131 | 131 | 'ImageHistoryList' => 'includes/ImagePage.php', |
132 | 132 | 'ImageHistoryPseudoPager' => 'includes/ImagePage.php', |
— | — | @@ -167,6 +167,7 @@ |
168 | 168 | 'MessageCache' => 'includes/MessageCache.php', |
169 | 169 | 'MimeMagic' => 'includes/MimeMagic.php', |
170 | 170 | 'MWException' => 'includes/Exception.php', |
| 171 | + 'MWHttpRequest' => 'includes/HttpFunctions.php', |
171 | 172 | 'MWMemcached' => 'includes/memcached-client.php', |
172 | 173 | 'MWNamespace' => 'includes/Namespace.php', |
173 | 174 | 'OldChangesList' => 'includes/ChangesList.php', |
Index: trunk/phase3/includes/HttpFunctions.old.php |
— | — | @@ -0,0 +1,24 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * HttpRequest was renamed to MWHttpRequest in order |
| 6 | + * to prevent conflicts with PHP's HTTP extension |
| 7 | + * which also defines an HttpRequest class. |
| 8 | + * http://www.php.net/manual/en/class.httprequest.php |
| 9 | + * |
| 10 | + * This is for backwards compatibility. |
| 11 | + */ |
| 12 | + |
| 13 | +class HttpRequest extends MWHttpRequest { } |
| 14 | +<?php |
| 15 | + |
| 16 | +/** |
| 17 | + * HttpRequest was renamed to MWHttpRequest in order |
| 18 | + * to prevent conflicts with PHP's HTTP extension |
| 19 | + * which also defines an HttpRequest class. |
| 20 | + * http://www.php.net/manual/en/class.httprequest.php |
| 21 | + * |
| 22 | + * This is for backwards compatibility. |
| 23 | + */ |
| 24 | + |
| 25 | +class HttpRequest extends MWHttpRequest { } |
Index: trunk/phase3/includes/HttpFunctions.php |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | * |
17 | 17 | * @param $method String: HTTP method. Usually GET/POST |
18 | 18 | * @param $url String: full URL to act on |
19 | | - * @param $options Array: options to pass to HttpRequest object. |
| 19 | + * @param $options Array: options to pass to MWHttpRequest object. |
20 | 20 | * Possible keys for the array: |
21 | 21 | * - timeout Timeout length in seconds |
22 | 22 | * - postData An array of key-value pairs or a url-encoded form data |
— | — | @@ -40,7 +40,7 @@ |
41 | 41 | $options['timeout'] = 'default'; |
42 | 42 | } |
43 | 43 | |
44 | | - $req = HttpRequest::factory( $url, $options ); |
| 44 | + $req = MWHttpRequest::factory( $url, $options ); |
45 | 45 | $status = $req->execute(); |
46 | 46 | |
47 | 47 | if ( $status->isOK() ) { |
— | — | @@ -133,8 +133,11 @@ |
134 | 134 | /** |
135 | 135 | * This wrapper class will call out to curl (if available) or fallback |
136 | 136 | * to regular PHP if necessary for handling internal HTTP requests. |
| 137 | + * |
| 138 | + * Renamed from HttpRequest to MWHttpRequst to avoid conflict with |
| 139 | + * php's HTTP extension. |
137 | 140 | */ |
138 | | -class HttpRequest { |
| 141 | +class MWHttpRequest { |
139 | 142 | protected $content; |
140 | 143 | protected $timeout = 'default'; |
141 | 144 | protected $headersOnly = null; |
— | — | @@ -195,7 +198,7 @@ |
196 | 199 | |
197 | 200 | /** |
198 | 201 | * Generate a new request object |
199 | | - * @see HttpRequest::__construct |
| 202 | + * @see MWHttpRequest::__construct |
200 | 203 | */ |
201 | 204 | public static function factory( $url, $options = null ) { |
202 | 205 | if ( !Http::$httpEngine ) { |
— | — | @@ -477,7 +480,7 @@ |
478 | 481 | } |
479 | 482 | |
480 | 483 | /** |
481 | | - * Tells the HttpRequest object to use this pre-loaded CookieJar. |
| 484 | + * Tells the MWHttpRequest object to use this pre-loaded CookieJar. |
482 | 485 | * |
483 | 486 | * @param $jar CookieJar |
484 | 487 | */ |
— | — | @@ -792,9 +795,9 @@ |
793 | 796 | } |
794 | 797 | |
795 | 798 | /** |
796 | | - * HttpRequest implemented using internal curl compiled into PHP |
| 799 | + * MWHttpRequest implemented using internal curl compiled into PHP |
797 | 800 | */ |
798 | | -class CurlHttpRequest extends HttpRequest { |
| 801 | +class CurlHttpRequest extends MWHttpRequest { |
799 | 802 | static $curlMessageMap = array( |
800 | 803 | 6 => 'http-host-unreachable', |
801 | 804 | 28 => 'http-timed-out' |
— | — | @@ -907,7 +910,7 @@ |
908 | 911 | } |
909 | 912 | } |
910 | 913 | |
911 | | -class PhpHttpRequest extends HttpRequest { |
| 914 | +class PhpHttpRequest extends MWHttpRequest { |
912 | 915 | protected function urlToTcp( $url ) { |
913 | 916 | $parsedUrl = parse_url( $url ); |
914 | 917 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -421,6 +421,8 @@ |
422 | 422 | some cases |
423 | 423 | * (bug 25670) wfFindFile() now checks the namespace of the given title, only |
424 | 424 | "File" and "Media" are allowed now |
| 425 | +* (bug 25872) Rename the HttpRequest class to MWHttpRequest to avoid conflict |
| 426 | + with php extension that defines same class. |
425 | 427 | |
426 | 428 | === API changes in 1.17 === |
427 | 429 | * (bug 22738) Allow filtering by action type on query=logevent. |