From: jenkins-bot Date: Thu, 28 Dec 2017 09:44:58 +0000 (+0000) Subject: Merge "Change php extract() to explicit code" X-Git-Tag: 1.31.0-rc.0~1070 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=1a40e0cc86b6ee0706606ded3ea243dfde4a414c;hp=ffaf2020c4154d79fb954c1676f482e408ba503c Merge "Change php extract() to explicit code" --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 10a338ed01..078de3c601 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -3114,10 +3114,29 @@ class Parser { throw $ex; } - # The interface for parser functions allows for extracting - # flags into the local scope. Extract any forwarded flags - # here. - extract( $result ); + // Extract any forwarded flags + if ( isset( $result['found'] ) ) { + $found = $result['found']; + } + if ( array_key_exists( 'text', $result ) ) { + // a string or null + $text = $result['text']; + } + if ( isset( $result['nowiki'] ) ) { + $nowiki = $result['nowiki']; + } + if ( isset( $result['isHTML'] ) ) { + $isHTML = $result['isHTML']; + } + if ( isset( $result['forceRawInterwiki'] ) ) { + $forceRawInterwiki = $result['forceRawInterwiki']; + } + if ( isset( $result['isChildObj'] ) ) { + $isChildObj = $result['isChildObj']; + } + if ( isset( $result['isLocalObj'] ) ) { + $isLocalObj = $result['isLocalObj']; + } } } @@ -3862,11 +3881,12 @@ class Parser { } if ( is_array( $output ) ) { - # Extract flags to local scope (to override $markerType) + // Extract flags $flags = $output; $output = $flags[0]; - unset( $flags[0] ); - extract( $flags ); + if ( isset( $flags['markerType'] ) ) { + $markerType = $flags['markerType']; + } } } else { if ( is_null( $attrText ) ) { diff --git a/includes/parser/Preprocessor_DOM.php b/includes/parser/Preprocessor_DOM.php index 2588962604..5368125f35 100644 --- a/includes/parser/Preprocessor_DOM.php +++ b/includes/parser/Preprocessor_DOM.php @@ -559,8 +559,16 @@ class Preprocessor_DOM extends Preprocessor { 'count' => $count ]; $stack->push( $piece ); $accum =& $stack->getAccum(); - $flags = $stack->getFlags(); - extract( $flags ); + $stackFlags = $stack->getFlags(); + if ( isset( $stackFlags['findEquals'] ) ) { + $findEquals = $stackFlags['findEquals']; + } + if ( isset( $stackFlags['findPipe'] ) ) { + $findPipe = $stackFlags['findPipe']; + } + if ( isset( $stackFlags['inHeading'] ) ) { + $inHeading = $stackFlags['inHeading']; + } $i += $count; } } elseif ( $found == 'line-end' ) { @@ -610,8 +618,16 @@ class Preprocessor_DOM extends Preprocessor { // Unwind the stack $stack->pop(); $accum =& $stack->getAccum(); - $flags = $stack->getFlags(); - extract( $flags ); + $stackFlags = $stack->getFlags(); + if ( isset( $stackFlags['findEquals'] ) ) { + $findEquals = $stackFlags['findEquals']; + } + if ( isset( $stackFlags['findPipe'] ) ) { + $findPipe = $stackFlags['findPipe']; + } + if ( isset( $stackFlags['inHeading'] ) ) { + $inHeading = $stackFlags['inHeading']; + } // Append the result to the enclosing accumulator $accum .= $element; @@ -640,8 +656,16 @@ class Preprocessor_DOM extends Preprocessor { $stack->push( $piece ); $accum =& $stack->getAccum(); - $flags = $stack->getFlags(); - extract( $flags ); + $stackFlags = $stack->getFlags(); + if ( isset( $stackFlags['findEquals'] ) ) { + $findEquals = $stackFlags['findEquals']; + } + if ( isset( $stackFlags['findPipe'] ) ) { + $findPipe = $stackFlags['findPipe']; + } + if ( isset( $stackFlags['inHeading'] ) ) { + $inHeading = $stackFlags['inHeading']; + } } else { # Add literal brace(s) $accum .= htmlspecialchars( str_repeat( $curChar, $count ) ); @@ -748,8 +772,16 @@ class Preprocessor_DOM extends Preprocessor { $accum .= $s; } } - $flags = $stack->getFlags(); - extract( $flags ); + $stackFlags = $stack->getFlags(); + if ( isset( $stackFlags['findEquals'] ) ) { + $findEquals = $stackFlags['findEquals']; + } + if ( isset( $stackFlags['findPipe'] ) ) { + $findPipe = $stackFlags['findPipe']; + } + if ( isset( $stackFlags['inHeading'] ) ) { + $inHeading = $stackFlags['inHeading']; + } # Add XML element to the enclosing accumulator $accum .= $element; diff --git a/includes/parser/Preprocessor_Hash.php b/includes/parser/Preprocessor_Hash.php index 735c33a4fe..145fbbc592 100644 --- a/includes/parser/Preprocessor_Hash.php +++ b/includes/parser/Preprocessor_Hash.php @@ -497,7 +497,16 @@ class Preprocessor_Hash extends Preprocessor { 'count' => $count ]; $stack->push( $piece ); $accum =& $stack->getAccum(); - extract( $stack->getFlags() ); + $stackFlags = $stack->getFlags(); + if ( isset( $stackFlags['findEquals'] ) ) { + $findEquals = $stackFlags['findEquals']; + } + if ( isset( $stackFlags['findPipe'] ) ) { + $findPipe = $stackFlags['findPipe']; + } + if ( isset( $stackFlags['inHeading'] ) ) { + $inHeading = $stackFlags['inHeading']; + } $i += $count; } } elseif ( $found == 'line-end' ) { @@ -554,7 +563,16 @@ class Preprocessor_Hash extends Preprocessor { // Unwind the stack $stack->pop(); $accum =& $stack->getAccum(); - extract( $stack->getFlags() ); + $stackFlags = $stack->getFlags(); + if ( isset( $stackFlags['findEquals'] ) ) { + $findEquals = $stackFlags['findEquals']; + } + if ( isset( $stackFlags['findPipe'] ) ) { + $findPipe = $stackFlags['findPipe']; + } + if ( isset( $stackFlags['inHeading'] ) ) { + $inHeading = $stackFlags['inHeading']; + } // Append the result to the enclosing accumulator array_splice( $accum, count( $accum ), 0, $element ); @@ -584,7 +602,16 @@ class Preprocessor_Hash extends Preprocessor { $stack->push( $piece ); $accum =& $stack->getAccum(); - extract( $stack->getFlags() ); + $stackFlags = $stack->getFlags(); + if ( isset( $stackFlags['findEquals'] ) ) { + $findEquals = $stackFlags['findEquals']; + } + if ( isset( $stackFlags['findPipe'] ) ) { + $findPipe = $stackFlags['findPipe']; + } + if ( isset( $stackFlags['inHeading'] ) ) { + $inHeading = $stackFlags['inHeading']; + } } else { # Add literal brace(s) self::addLiteral( $accum, str_repeat( $curChar, $count ) ); @@ -695,7 +722,16 @@ class Preprocessor_Hash extends Preprocessor { } } - extract( $stack->getFlags() ); + $stackFlags = $stack->getFlags(); + if ( isset( $stackFlags['findEquals'] ) ) { + $findEquals = $stackFlags['findEquals']; + } + if ( isset( $stackFlags['findPipe'] ) ) { + $findPipe = $stackFlags['findPipe']; + } + if ( isset( $stackFlags['inHeading'] ) ) { + $inHeading = $stackFlags['inHeading']; + } # Add XML element to the enclosing accumulator array_splice( $accum, count( $accum ), 0, $element ); diff --git a/includes/parser/Sanitizer.php b/includes/parser/Sanitizer.php index 20fee2db29..b570a43c06 100644 --- a/includes/parser/Sanitizer.php +++ b/includes/parser/Sanitizer.php @@ -477,7 +477,16 @@ class Sanitizer { public static function removeHTMLtags( $text, $processCallback = null, $args = [], $extratags = [], $removetags = [], $warnCallback = null ) { - extract( self::getRecognizedTagData( $extratags, $removetags ) ); + $tagData = self::getRecognizedTagData( $extratags, $removetags ); + $htmlpairs = $tagData['htmlpairs']; + $htmlsingle = $tagData['htmlsingle']; + $htmlsingleonly = $tagData['htmlsingleonly']; + $htmlnest = $tagData['htmlnest']; + $tabletags = $tagData['tabletags']; + $htmllist = $tagData['htmllist']; + $listtags = $tagData['listtags']; + $htmlsingleallowed = $tagData['htmlsingleallowed']; + $htmlelements = $tagData['htmlelements']; # Remove HTML comments $text = self::removeHTMLcomments( $text );