Gergő Tisza has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/249873

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, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/73/249873/1

diff --git a/includes/MagicWord.php b/includes/MagicWord.php
index 424735e..cfaa5cf 100644
--- a/includes/MagicWord.php
+++ b/includes/MagicWord.php
@@ -954,7 +954,7 @@
                        $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 +966,7 @@
                        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: newchange
Gerrit-Change-Id: I1d13f8542a4cf11c8e87cd4f6a983fa852dfdf1e
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: GergÅ‘ Tisza <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to