Skip to content

Commit 8a0cfb0

Browse files
1 parent 50c123b commit 8a0cfb0

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

ChangeLog-4.8.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes of the PHPUnit 4.8 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
44

5+
## [4.8.33] - 2017-MM-DD
6+
7+
### Fixed
8+
9+
* Fixed [#2331](https://github.com/sebastianbergmann/phpunit/issues/2331): Boolean environment variable values specified in XML get mangled
10+
511
## [4.8.32] - 2017-01-22
612

713
### Fixed

src/Util/Configuration.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,11 @@ public function getPHPConfiguration()
473473
$name = (string) $var->getAttribute('name');
474474
$value = (string) $var->getAttribute('value');
475475

476-
$result[$array][$name] = $this->getBoolean($value, $value);
476+
if ($array !== 'env') {
477+
$result[$array][$name] = $this->getBoolean($value, $value);
478+
} else {
479+
$result[$array][$name] = $value;
480+
}
477481
}
478482
}
479483

tests/Util/ConfigurationTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ public function testPHPConfigurationIsReadCorrectly()
277277
'ini' => array('foo' => 'bar'),
278278
'const' => array('FOO' => false, 'BAR' => true),
279279
'var' => array('foo' => false),
280-
'env' => array('foo' => true),
280+
'env' => array('foo' => 'true'),
281281
'post' => array('foo' => 'bar'),
282282
'get' => array('foo' => 'bar'),
283283
'cookie' => array('foo' => 'bar'),
@@ -302,8 +302,8 @@ public function testPHPConfigurationIsHandledCorrectly()
302302
$this->assertEquals(false, FOO);
303303
$this->assertEquals(true, BAR);
304304
$this->assertEquals(false, $GLOBALS['foo']);
305-
$this->assertEquals(true, $_ENV['foo']);
306-
$this->assertEquals(true, getenv('foo'));
305+
$this->assertEquals('true', $_ENV['foo']);
306+
$this->assertEquals('true', getenv('foo'));
307307
$this->assertEquals('bar', $_POST['foo']);
308308
$this->assertEquals('bar', $_GET['foo']);
309309
$this->assertEquals('bar', $_COOKIE['foo']);
@@ -319,11 +319,11 @@ public function testPHPConfigurationIsHandledCorrectly()
319319
*/
320320
public function testHandlePHPConfigurationDoesNotOverwrittenExistingEnvArrayVariables()
321321
{
322-
$_ENV['foo'] = false;
322+
$_ENV['foo'] = 'false';
323323
$this->configuration->handlePHPConfiguration();
324324

325-
$this->assertEquals(false, $_ENV['foo']);
326-
$this->assertEquals(true, getenv('foo'));
325+
$this->assertEquals('false', $_ENV['foo']);
326+
$this->assertEquals('true', getenv('foo'));
327327
}
328328

329329
/**
@@ -336,7 +336,7 @@ public function testHandlePHPConfigurationDoesNotOverriteVariablesFromPutEnv()
336336
putenv('foo=putenv');
337337
$this->configuration->handlePHPConfiguration();
338338

339-
$this->assertEquals(true, $_ENV['foo']);
339+
$this->assertEquals('true', $_ENV['foo']);
340340
$this->assertEquals('putenv', getenv('foo'));
341341
}
342342

0 commit comments

Comments
 (0)