PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Testing » PHPUnit » Bug #3127

PHPUnit_GUI_HTML and $_REQUEST

Details

Submitted2005-01-06 21:37 UTC
Fromcricket at djcricket dot com
StatusClosed
PackagePHPUnit
PHP VersionIrrelevant
OS-
Roadmaps(Not assigned)

Comments

[2005-01-06 21:37 UTC] cricket at djcricket dot com

Description:
------------
The PHPUnit_GUI_HTML class appears to use the $_REQUEST while running it's tests, so any test which munges that superglobal will cause PHPUnit_GUI_HTML to stop running.

By copying the $_REQUEST variable when show() is called, this can be avoided. I've provided the following patches:

Index: HTML.php
===================================================================
--- HTML.php (revision 78)
+++ HTML.php (working copy)
@@ -66,10 +66,11 @@
*/
function show()
{
+ $request = $_REQUEST;
$showPassed=FALSE;
- $submitted = @$_REQUEST['submitted'];
+ $submitted = @$request['submitted'];
if ($submitted) {
- $showPassed = @$_REQUEST['showOK'] ? TRUE : FALSE;
+ $showPassed = @$request['showOK'] ? TRUE : FALSE;
}

$suiteResults = array();
@@ -79,7 +80,7 @@
// mostly is something like 'tests' or alike
$removablePrefix = explode('_',$aSuite->getName());
$aSuiteResult['name'] = str_replace($removablePrefix[0].'_', '', $aSuite->getName());
- if ($submitted && isset($_REQUEST[$aSuiteResult['name']])) {
+ if ($submitted && isset($request[$aSuiteResult['name']])) {
$result = PHPUnit::run($aSuite);

$aSuiteResult['counts']['run'] = $result->runCount();

Index: HTML.tpl
===================================================================
--- HTML.tpl (revision 78)
+++ HTML.tpl (working copy)
@@ -48,7 +48,7 @@
<input type="checkbox" onClick="unCheckAll()" name="allChecked">
(un)check all
   
- show OK <input type="checkbox" name="showOK" <?php echo @$_REQUEST['showOK']?'checked':''?>>
+ show OK <input type="checkbox" name="showOK" <?php echo @$request['showOK']?'checked':''?>>
   
<input type="submit" name="submitted" value="run tests">
</td>
@@ -57,7 +57,7 @@
<?php foreach($suiteResults as $aResult): ?>
<tr>
<th colspan="10">
- <input type="checkbox" name="<?php echo $aResult['name'] ?>" <?php echo @$_REQUEST[$aResult['name']]?'checked':'' ?>>
+ <input type="checkbox" name="<?php echo $aResult['name'] ?>" <?php echo @$request[$aResult['name']]?'checked':'' ?>>
<?php echo $aResult['name'] ?>
 
<?php if (isset($aResult['addInfo'])): ?>