Convert the string to single quoted and manually escape it.
authorPlatonides <platonides@users.mediawiki.org>
Thu, 27 Oct 2011 21:18:01 +0000 (21:18 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Thu, 27 Oct 2011 21:18:01 +0000 (21:18 +0000)
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.

tests/phpunit/includes/parser/MediaWikiParserTest.php

index 83203b6..e25c3fd 100644 (file)
@@ -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 ) );