Index: trunk/tools/code-utils/check-vars.php |
— | — | @@ -60,6 +60,12 @@ |
61 | 61 | static $functionIgnorePrefixes = array( "pg_", "oci_", "db2_", "gmp_", "sqlsrv_", "exif_", "fss_", "tidy_", |
62 | 62 | "apc_", "eaccelerator_", "xcache_", "wincache_", "apache_", "xdiff_", "wikidiff2_", "parsekit_", |
63 | 63 | "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 | + |
64 | 70 | protected $generateDeprecatedList = false; |
65 | 71 | |
66 | 72 | /* Values for status */ |
— | — | @@ -620,6 +626,11 @@ |
621 | 627 | return; |
622 | 628 | } |
623 | 629 | |
| 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 | + |
624 | 635 | if ( function_exists( $token[1] ) ) { |
625 | 636 | return; |
626 | 637 | } |