HomePhabricator

AjaxResponse: Fix broken logic for extracting HTTP status codes

Authored by bd808.
This commit no longer exists in the repository. It may have been part of a branch which was deleted.This commit has been deleted in the repository: it is no longer reachable from any branch, tag, or ref.

Description

AjaxResponse: Fix broken logic for extracting HTTP status codes

Follows-up 6584cef207 (r16266; 2006; MediaWiki 1.8.0).
This regex was just trimming whitespace from the start of the string. It
matched whitespace, then a match group for a first sequence of digits. The
replacement is just the digits match. This is essentially ltrim(). It didn't
account for the content after the match.

echo preg_replace( '/^ *(\d+)/', '\1', '200 OK' );
"200 OK"

This was causing:

Warning: Unknown HTTP status code 200 OK in libs/HttpStatus.php:100
Warning: Unknown HTTP status code 304 Not Modified OK in libs/HttpStatus.php:100

It defaults to HTTP 200. So presumbaly the impact was low. Though it may've caused
304 responses to have been broken (content body missing).

Bug: T102028
Change-Id: Iafff9982bbbee893c13f891901dde88f998db7a6
(cherry picked from commit 7b6890654a3ef994eb12acd2f37e93d964878288)

Details

Committed
mmodellJun 11 2015, 6:28 PM
ChangeId
Iafff9982bbbee893c13f891901dde88f998db7a6

Commit No Longer Exists

This commit no longer exists in the repository.