Merge "Use MediaWiki\SuppressWarnings around trigger_error('') instead @"
authorD3r1ck01 <alangiderick@gmail.com>
Wed, 19 Dec 2018 17:15:17 +0000 (17:15 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 19 Dec 2018 17:15:17 +0000 (17:15 +0000)
1  2 
includes/shell/Command.php

@@@ -429,20 -429,21 +429,21 @@@ class Command 
                        }
  
                        // clear get_last_error without actually raising an error
 -                      // from http://php.net/manual/en/function.error-get-last.php#113518
 +                      // from https://secure.php.net/manual/en/function.error-get-last.php#113518
                        // TODO replace with clear_last_error when requirements are bumped to PHP7
                        set_error_handler( function () {
                        }, 0 );
-                       // phpcs:ignore Generic.PHP.NoSilencedErrors.Discouraged
-                       @trigger_error( '' );
+                       \MediaWiki\suppressWarnings();
+                       trigger_error( '' );
+                       \MediaWiki\restoreWarnings();
                        restore_error_handler();
  
 -                      $readPipes = wfArrayFilterByKey( $pipes, function ( $fd ) use ( $desc ) {
 +                      $readPipes = array_filter( $pipes, function ( $fd ) use ( $desc ) {
                                return $desc[$fd][0] === 'pipe' && $desc[$fd][1] === 'r';
 -                      } );
 -                      $writePipes = wfArrayFilterByKey( $pipes, function ( $fd ) use ( $desc ) {
 +                      }, ARRAY_FILTER_USE_KEY );
 +                      $writePipes = array_filter( $pipes, function ( $fd ) use ( $desc ) {
                                return $desc[$fd][0] === 'pipe' && $desc[$fd][1] === 'w';
 -                      } );
 +                      }, ARRAY_FILTER_USE_KEY );
                        // stream_select parameter names are from the POV of us being able to do the operation;
                        // proc_open desriptor types are from the POV of the process doing it.
                        // So $writePipes is passed as the $read parameter and $readPipes as $write.