r77490 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77489‎ | r77490 | r77491 >
Date:18:27, 30 November 2010
Author:platonides
Status:deferred
Tags:
Comment:
Add poisoned functions.
Similar to #pragma GCC poison
Modified paths:
  • /trunk/tools/code-utils/check-vars.php (modified) (history)

Diff [purge]

Index: trunk/tools/code-utils/check-vars.php
@@ -60,6 +60,12 @@
6161 static $functionIgnorePrefixes = array( "pg_", "oci_", "db2_", "gmp_", "sqlsrv_", "exif_", "fss_", "tidy_",
6262 "apc_", "eaccelerator_", "xcache_", "wincache_", "apache_", "xdiff_", "wikidiff2_", "parsekit_",
6363 "wddx_", "setproctitle", "utf8_", "normalizer_", "dba_", "pcntl_", "finfo_" );
 64+ # Functions to be avoided. Insert in lowercase.
 65+ static $poisonedFunctions = array(
 66+ 'addslashes' => 'Replace with Database::addQuotes/strencode',
 67+ 'mysql_escape_string' => 'Replace with Database::addQuotes/strencode',
 68+ );
 69+
6470 protected $generateDeprecatedList = false;
6571
6672 /* Values for status */
@@ -620,6 +626,11 @@
621627 return;
622628 }
623629
 630+ if ( isset( self::$poisonedFunctions[ strtolower($token[1]) ] ) ) {
 631+ $this->warning( "Poisoned function {$token[1]} called from {$this->mFunction} in line {$token[2]}: " . self::$poisonedFunctions[strtolower($token[1])] );
 632+ return;
 633+ }
 634+
624635 if ( function_exists( $token[1] ) ) {
625636 return;
626637 }

Status & tagging log