Commit graph

11 commits

Author SHA1 Message Date
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
Umherirrender
d19a4dd230 Fix return in HttpStatus::header
No caller expected a bool as return, which is not given in any case,
so remove it

Change-Id: Iaf994342e9f783108c767bb2de13af7345247805
2017-09-10 01:44:29 +02:00
Tim Starling
f193271cff Log a backtrace from the culprit location if headers were already sent
Install the backtrace collector very early, so that we can get the
backtrace even if headers were sent from LocalSettings.php.

Bug: T157392
Change-Id: I9bc732b34481c95afb5362e135a87bd4302498e2
2017-02-23 14:10:12 +11:00
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
Amir E. Aharoni
c6f066b88c Make long lines shorter to pass phpcs in 6 files
Bug: T102614
Change-Id: I3159c33ddd16bded94a70f363258a294f407fc58
2015-09-26 17:07:06 +00:00
Timo Tijhof
7b835dd126 HttpStatus: Implement header() method
Standardise this. Currently MediaWiki does this in many different ways.

> WebResponse->header( "HTTP/1.0 $code $message" );
> WebResponse->header( "HTTP/1.1 $code $message" );
> WebResponse->header( "HTTP/1.x $code $message" );
> WebResponse->header( "HTTP/1.1 $code " . HttpStatus::getMessage( $code ) );
> WebResponse->header( "HTTP/1.1 $code $message", true, $code );
> header( "Status: $code $message", true, $code );

Change-Id: I1551e89808a1a67310549ec8d9fcb387754c9169
2015-06-04 02:15:39 +00:00
umherirrender
b18d8d7e01 Remove OutputPage::getStatusMessage() (deprecated since 1.18)
Also removed a comment where the method was mentioned.

Change-Id: I802f0f41e107a1d677fb899f6e09ea31df3c4e6f
2014-07-09 01:41:18 +02:00
Faidon Liambotis
c4f14616c4 HttpStatus: add RFC 6585 status codes
Add newer (Apr 2012) HTTP status codes & their messages to HttpStatus'
getMessage. Adds 428, 429, 431, 511 per RFC 6585, "Additional HTTP
Status Codes".

Change-Id: Ia055880c4b2f3ac43cf5d94dbdd45a3690a58569
2014-03-28 12:25:14 +02:00
Ori Livneh
49bec29fc9 Fix typo ('associed' => 'associated').
Change-Id: I5ea2eec92ebe397f2d269562f1650e59cb969a19
2013-06-14 15:26:36 -07:00
Alexandre Emsenhuber
63176b99b7 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I1deb70318d01a257b51948ba806d80cd1a239f4f
2012-05-04 08:47:07 +02:00
Antoine Musso
a2d41b8d6f HTTP status messages move: OutputPage -> HttpStatus
OutputPage::getStatusMessage() is a method to convert a numeric HTTP status
code to an english message.  It does not really belong to the OutputPage were
it was for historical reason.
This patch move the basic function to a non MediaWiki dependant class in our
directory includes/libs.  We could potentially enhances it, but I do not see
any use cases for us yet.
I have renamed the method to the shorter 'getMessage' since the word 'status'
is now in the class name.

Summary of changes:
* OutputPage::getStatusMessage becomes HttpStatus::getMessage
* Method moved to the new includes/libs/HttpStatus.php
* Autoloader updated
* History kept by using 'svn copy'
* No functional changes
* No input/output format changes
* Old occurences modified in phase3
* OutputPage::getStatusMessages() marked as deprecated

PHPUnit test suite is fine.
Tested manually using a redirection
2011-07-04 21:01:19 +00:00