Bug: T115514
Bug: T117066
Change-Id: I1d13f8542a4cf11c8e87cd4f6a983fa852dfdf1e
$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 ) {
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;