-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from phpbb/paul999-patch-1
Return a fatal when using enable_super_globals()
- Loading branch information
Showing
3 changed files
with
97 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* | ||
* EPV :: The phpBB Forum Extension Pre Validator. | ||
* | ||
* @copyright (c) 2014 phpBB Limited <https://www.phpbb.com> | ||
* @license GNU General Public License, version 2 (GPL-2.0) | ||
* | ||
*/ | ||
|
||
class epv_test_validate_php_functions extends PHPUnit_Framework_TestCase | ||
{ | ||
public static function setUpBeforeClass() | ||
{ | ||
require_once('./tests/Mock/Output.php'); | ||
} | ||
|
||
public function test_usage_of_enable_globals() { | ||
$output = $this->getOutputMock(); | ||
$output->expects($this->exactly(1)) | ||
->method('addMessage') | ||
->with(\Phpbb\Epv\Output\OutputInterface::FATAL, 'The use of enable_super_globals() is not allowed for security reasons on line 7 in tests/testFiles/enable_globalsphp') | ||
; | ||
|
||
$file = $this->getLoader()->loadFile('tests/testFiles/enable_globals.php'); | ||
|
||
$tester = new \Phpbb\Epv\Tests\Tests\epv_test_validate_php_functions(false, $output, '/a/b/', 'epv/test', false, '/a/'); | ||
$tester->validateFile($file); | ||
} | ||
|
||
private function getLoader() | ||
{ | ||
return $file = new \Phpbb\Epv\Files\FileLoader(new \Phpbb\Epv\Tests\Mock\Output(), false, '.', '.'); | ||
} | ||
|
||
/** | ||
* @return \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
function getOutputMock() | ||
{ | ||
return $this->getMock('Phpbb\Epv\Output\OutputInterface'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
if (!defined('IN_PHPBB')) { | ||
exit; | ||
} | ||
|
||
$request->enable_super_globals(); | ||
|