From: Platonides Date: Thu, 27 Oct 2011 21:18:01 +0000 (+0000) Subject: Convert the string to single quoted and manually escape it. X-Git-Tag: 1.31.0-rc.0~26865 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=58c4ae9c79383c1d541f00ed7f8abb43d1099a5a;p=lhc%2Fweb%2Fwiklou.git Convert the string to single quoted and manually escape it. http://us.php.net/manual/en/language.types.string.php addslashes() is convenient, but this way we have no legitimate usage, and it's easier to have it banned everywhere. --- diff --git a/tests/phpunit/includes/parser/MediaWikiParserTest.php b/tests/phpunit/includes/parser/MediaWikiParserTest.php index 83203b682f..e25c3fdd0b 100644 --- a/tests/phpunit/includes/parser/MediaWikiParserTest.php +++ b/tests/phpunit/includes/parser/MediaWikiParserTest.php @@ -24,7 +24,7 @@ class MediaWikiParserTest { */ $className = str_replace( '.', '_', ucfirst( basename( $filename, '.txt' ) ) ); - eval( "/** @group Database\n@group Parser\n*/ class $className extends NewParserTest { protected \$file = \"" . addslashes( $filename ) . "\"; } " ); + eval( "/** @group Database\n@group Parser\n*/ class $className extends NewParserTest { protected \$file = '" . strtr( $filename, array( "'" => "\\'", '\\' => '\\\\' ) ) . "'; } " ); $parserTester = new $className( $testsName ); $suite->addTestSuite( new ReflectionClass ( $parserTester ) );