jenkins-bot has submitted this change and it was merged.
Change subject: Include preg_last_error() in error message when preg_* fails
......................................................................
Include preg_last_error() in error message when preg_* fails
Bug: T115514
Bug: T117066
Change-Id: I1d13f8542a4cf11c8e87cd4f6a983fa852dfdf1e
---
M includes/MagicWord.php
1 file changed, 4 insertions(+), 2 deletions(-)
Approvals:
Gergő Tisza: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/MagicWord.php b/includes/MagicWord.php
index 424735e..17c7cd4 100644
--- a/includes/MagicWord.php
+++ b/includes/MagicWord.php
@@ -954,7 +954,8 @@
$matches = array();
$matched = preg_match_all( $regex, $text, $matches,
PREG_SET_ORDER );
if ( $matched === false ) {
- throw new Exception( __METHOD__ . ':
preg_match_all returned false' );
+ throw new Exception( __METHOD__ . ':
preg_match_all returned false with error code '
+ . preg_last_error() );
}
if ( $matched ) {
foreach ( $matches as $m ) {
@@ -966,7 +967,8 @@
if ( $replaced !== null ) {
$text = $replaced;
} else {
- throw new Exception( __METHOD__ . ':
preg_replace returned null' );
+ throw new Exception( __METHOD__ . ':
preg_replace returned null with error code '
+ . preg_last_error() );
}
}
return $found;
--
To view, visit https://gerrit.wikimedia.org/r/249873
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I1d13f8542a4cf11c8e87cd4f6a983fa852dfdf1e
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Gergő Tisza <[email protected]>
Gerrit-Reviewer: Jackmcbarn <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits