jenkins-bot has submitted this change and it was merged.
Change subject: Distinguish redactions from the string "REDACTED" in
formatRedactedTrace
......................................................................
Distinguish redactions from the string "REDACTED" in formatRedactedTrace
In the output of MWExceptionHandler::formatRedactedTrace, it is not
possible to determine (without checking the configuration) whether arg 0
in "foo('REDACTED')" was redacted or was merely passed the string
"REDACTED".
This patch changes redaction to instead output "foo(REDACTED)" in the
case of redaction. This parallels the situation with arrays and objects,
where for example "foo(Array)" was passed an array while "foo('Array')"
was passed the string "Array".
Change-Id: Ia2a761687c69b630afa3ccd8668b06b28e3ecdd3
---
M includes/Exception.php
1 file changed, 7 insertions(+), 2 deletions(-)
Approvals:
Krinkle: Looks good to me, but someone else must approve
Ori.livneh: Looks good to me, approved
Parent5446: Looks good to me, but someone else must approve
Liangent: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/includes/Exception.php b/includes/Exception.php
index fba857f..a91f865 100644
--- a/includes/Exception.php
+++ b/includes/Exception.php
@@ -686,6 +686,9 @@
global $wgRedactedFunctionArguments;
$finalExceptionText = '';
+ // Unique value to indicate redacted parameters
+ $redacted = new stdClass();
+
foreach ( $e->getTrace() as $i => $call ) {
$checkFor = array();
if ( isset( $call['class'] ) ) {
@@ -700,7 +703,7 @@
foreach ( $checkFor as $check ) {
if ( isset(
$wgRedactedFunctionArguments[$check] ) ) {
foreach (
(array)$wgRedactedFunctionArguments[$check] as $argNo ) {
- $call['args'][$argNo] =
'REDACTED';
+ $call['args'][$argNo] =
$redacted;
}
}
}
@@ -722,7 +725,9 @@
$args = array();
if ( isset( $call['args'] ) ) {
foreach ( $call['args'] as $arg ) {
- if ( is_object( $arg ) ) {
+ if ( $arg === $redacted ) {
+ $args[] = 'REDACTED';
+ } elseif ( is_object( $arg ) ) {
$args[] = 'Object(' .
get_class( $arg ) . ')';
} elseif( is_array( $arg ) ) {
$args[] = 'Array';
--
To view, visit https://gerrit.wikimedia.org/r/91872
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ia2a761687c69b630afa3ccd8668b06b28e3ecdd3
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: Hashar <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Liangent <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits