r79264 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79263‎ | r79264 | r79265 >
Date:16:57, 30 December 2010
Author:platonides
Status:ok
Tags:
Comment:
Poison eval and create_function
The required file may contain only defines, so don't short-circuit.
Modified paths:
  • /trunk/tools/code-utils/check-vars.php (modified) (history)

Diff [purge]

Index: trunk/tools/code-utils/check-vars.php
@@ -71,6 +71,8 @@
7272 static $poisonedFunctions = array(
7373 'addslashes' => 'Replace with Database::addQuotes/strencode',
7474 'mysql_escape_string' => 'Replace with Database::addQuotes/strencode',
 75+ 'create_function' => 'create_function should be avoided. See http://www.mediawiki.org/wiki/Security_for_developers#Dynamic_code_generation',
 76+ 'eval' => 'eval should be avoided. See r78046', # eval.php is magically not listed for not containing any function. Should get an exception if it starts being parsed.
7577 );
7678
7779 protected $generateDeprecatedList = false;
@@ -555,7 +557,7 @@
556558 $this->mConstants = array_merge( $this->mConstants, self::$mRequireKnownConstants[$requirePath] );
557559 } else {
558560 $newCheck = new CheckVars;
559 - $newCheck->load( $requirePath );
 561+ $newCheck->load( $requirePath, false );
560562 $newCheck->execute();
561563 /* Get the classes defined there */
562564 $this->mKnownFileClasses = array_merge( $this->mKnownFileClasses, $newCheck->mKnownFileClasses );

Status & tagging log