r95493 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95492‎ | r95493 | r95494 >
Date:16:40, 25 August 2011
Author:reedy
Status:ok
Tags:
Comment:
Followup r90361, r90362

Document $limit parameter

Pass $limit parameter through if $limit && php > 5.4.0

Else false back to the default version, which sets the same parameters
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -298,7 +298,7 @@
299299 $needle = null;
300300 return;
301301 }
302 -
 302+
303303 if ( is_null( $needle ) ) {
304304 $needle = array( '%3B', '%40', '%24', '%21', '%2A', '%28', '%29', '%2C', '%2F' );
305305 if ( !isset( $_SERVER['SERVER_SOFTWARE'] ) || ( strpos( $_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS/7' ) === false ) ) {
@@ -431,7 +431,7 @@
432432 /**
433433 * Expand a potentially local URL to a fully-qualified URL. Assumes $wgServer
434434 * is correct.
435 - *
 435+ *
436436 * The meaning of the PROTO_* constants is as follows:
437437 * PROTO_HTTP: Output a URL starting with http://
438438 * PROTO_HTTPS: Output a URL starting with https://
@@ -449,15 +449,15 @@
450450 function wfExpandUrl( $url, $defaultProto = PROTO_CURRENT ) {
451451 global $wgServer, $wgCanonicalServer;
452452 $serverUrl = $defaultProto === PROTO_CANONICAL ? $wgCanonicalServer : $wgServer;
453 -
 453+
454454 if ( $defaultProto === PROTO_CURRENT ) {
455455 $defaultProto = WebRequest::detectProtocol() . '://';
456456 }
457 -
 457+
458458 // Analyze $serverUrl to obtain its protocol
459459 $bits = wfParseUrl( $serverUrl );
460460 $serverHasProto = $bits && $bits['scheme'] != '';
461 -
 461+
462462 if ( $defaultProto === PROTO_CANONICAL ) {
463463 if ( $serverHasProto ) {
464464 $defaultProto = $bits['scheme'] . '://';
@@ -467,9 +467,9 @@
468468 $defaultProto = PROTO_HTTP;
469469 }
470470 }
471 -
 471+
472472 $defaultProtoWithoutSlashes = substr( $defaultProto, 0, -2 );
473 -
 473+
474474 if( substr( $url, 0, 2 ) == '//' ) {
475475 return $defaultProtoWithoutSlashes . $url;
476476 } elseif( substr( $url, 0, 1 ) == '/' ) {
@@ -516,7 +516,7 @@
517517 // URLs weren't supported until 1.18
518518 $retval = $wgUrlProtocols;
519519 }
520 -
 520+
521521 // Cache return value
522522 if ( $includeProtocolRelative ) {
523523 $withProtRel = $retval;
@@ -1407,6 +1407,8 @@
14081408 * debug_backtrace is disabled, otherwise the output from
14091409 * debug_backtrace() (trimmed).
14101410 *
 1411+ * @param $limit int This parameter can be used to limit the number of stack frames returned
 1412+ *
14111413 * @return array of backtrace information
14121414 */
14131415 function wfDebugBacktrace( $limit = 0 ) {
@@ -1432,7 +1434,7 @@
14331435 }
14341436
14351437 if ( $limit && version_compare( PHP_VERSION, '5.4.0', '>=' ) ) {
1436 - return array_slice( debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, 1 ), 1 );
 1438+ return array_slice( debug_backtrace( DEBUG_BACKTRACE_PROVIDE_OBJECT, $limit ), 1 );
14371439 } else {
14381440 return array_slice( debug_backtrace(), 1 );
14391441 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r964981.18: MFT r95171, r95409, r95436, r95458, r95467, r95470, r95475, r95493, r95...catrope21:04, 7 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r90361There is a nice $limit parameter in PHP 5.4, but calling debug_backtrace on e...platonides20:11, 18 June 2011
r90362Follow up r90361platonides20:15, 18 June 2011

Status & tagging log