Skip to content

Commit 1bc1931

Browse files
Merge branch '2.3' into 2.7
* 2.3: [ci] Phpunit tests wont run if composer is installed in a wrapper [ci] Add version tag in phpunit wrapper to trigger cache-reset on demand fix race condition at mkdir (symfony#16258) [PropertyAccess] Test access to dynamic properties [PropertyAccess] Fix dynamic property accessing. Conflicts: src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
2 parents da95b53 + 3d41d93 commit 1bc1931

File tree

4 files changed

+39
-19
lines changed

4 files changed

+39
-19
lines changed

phpunit

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
#!/usr/bin/env php
22
<?php
33

4+
/*
5+
* This file is part of the Symfony package.
6+
*
7+
* (c) Fabien Potencier <[email protected]>
8+
*
9+
* For the full copyright and license information, please view the LICENSE
10+
* file that was distributed with this source code.
11+
*/
12+
13+
// Please update when phpunit needs to be reinstalled with fresh deps:
14+
// Cache-Id-Version: 2015-11-09 12:13 UTC
15+
416
use Symfony\Component\Process\ProcessUtils;
517

618
error_reporting(-1);
@@ -10,19 +22,11 @@ require __DIR__.'/src/Symfony/Component/Process/ProcessUtils.php';
1022
$PHPUNIT_VERSION = PHP_VERSION_ID >= 70000 ? '5.0' : '4.8';
1123
$PHPUNIT_DIR = __DIR__.'/.phpunit';
1224
$PHP = defined('PHP_BINARY') ? PHP_BINARY : 'php';
13-
14-
if (!file_exists($COMPOSER = __DIR__.'/composer.phar')) {
15-
$COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `where.exe composer.phar` : (`which composer.phar` ?: `which composer`));
16-
if (!file_exists($COMPOSER)) {
17-
stream_copy_to_stream(
18-
fopen('https://getcomposer.org/composer.phar', 'rb'),
19-
fopen($COMPOSER = __DIR__.'/composer.phar', 'wb')
20-
);
21-
}
22-
}
23-
2425
$PHP = ProcessUtils::escapeArgument($PHP);
25-
$COMPOSER = $PHP.' '.ProcessUtils::escapeArgument($COMPOSER);
26+
27+
$COMPOSER = file_exists($COMPOSER = __DIR__.'/composer.phar') || ($COMPOSER = rtrim('\\' === DIRECTORY_SEPARATOR ? `where.exe composer.phar` : `which composer.phar`))
28+
? $PHP.' '.ProcessUtils::escapeArgument($COMPOSER)
29+
: 'composer';
2630

2731
if (!file_exists("$PHPUNIT_DIR/phpunit-$PHPUNIT_VERSION/phpunit") || md5_file(__FILE__) !== @file_get_contents("$PHPUNIT_DIR/.md5")) {
2832
// Build a standalone phpunit without symfony/yaml

src/Symfony/Component/HttpKernel/HttpCache/Store.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@ class Store implements StoreInterface
3232
* Constructor.
3333
*
3434
* @param string $root The path to the cache directory
35+
*
36+
* @throws \RuntimeException
3537
*/
3638
public function __construct($root)
3739
{
3840
$this->root = $root;
3941
if (!is_dir($this->root)) {
40-
mkdir($this->root, 0777, true);
42+
if (false === @mkdir($this->root, 0777, true) && !is_dir($this->root)) {
43+
throw new \RuntimeException(sprintf('Unable to create the store directory (%s).', $this->root));
44+
}
4145
}
4246
$this->keyCache = new \SplObjectStorage();
4347
$this->locks = array();
@@ -74,7 +78,7 @@ public function cleanup()
7478
public function lock(Request $request)
7579
{
7680
$path = $this->getPath($this->getCacheKey($request).'.lck');
77-
if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true)) {
81+
if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) {
7882
return false;
7983
}
8084

@@ -338,7 +342,7 @@ private function load($key)
338342
private function save($key, $data)
339343
{
340344
$path = $this->getPath($key);
341-
if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true)) {
345+
if (!is_dir(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) {
342346
return false;
343347
}
344348

src/Symfony/Component/HttpKernel/Profiler/FileProfilerStorage.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ public function __construct($dsn)
4141
}
4242
$this->folder = substr($dsn, 5);
4343

44-
if (!is_dir($this->folder)) {
45-
mkdir($this->folder, 0777, true);
44+
if (!is_dir($this->folder) && false === @mkdir($this->folder, 0777, true) && !is_dir($this->folder)) {
45+
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $this->folder));
4646
}
4747
}
4848

@@ -128,6 +128,8 @@ public function read($token)
128128

129129
/**
130130
* {@inheritdoc}
131+
*
132+
* @throws \RuntimeException
131133
*/
132134
public function write(Profile $profile)
133135
{
@@ -137,8 +139,8 @@ public function write(Profile $profile)
137139
if (!$profileIndexed) {
138140
// Create directory
139141
$dir = dirname($file);
140-
if (!is_dir($dir)) {
141-
mkdir($dir, 0777, true);
142+
if (!is_dir($dir) && false === @mkdir($dir, 0777, true) && !is_dir($dir)) {
143+
throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $dir));
142144
}
143145
}
144146

src/Symfony/Component/HttpKernel/phpunit.xml.dist

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,14 @@
2525
</exclude>
2626
</whitelist>
2727
</filter>
28+
29+
<listeners>
30+
<listener class="Symfony\Bridge\PhpUnit\SymfonyTestsListener">
31+
<arguments>
32+
<array>
33+
<element><string>Symfony\Component\HttpFoundation</string></element>
34+
</array>
35+
</arguments>
36+
</listener>
37+
</listeners>
2838
</phpunit>

0 commit comments

Comments
 (0)