Merge branch '2.8' into 3.2
* 2.8: [Bridge\Doctrine] Fix change breaking doctrine-bundle test suite [HttpFoundation][bugfix] should always be initialized MockArraySessionStorage: updated phpdoc for $bags so that IDE autocompletion would work normalize paths before making them relative
This commit is contained in:
commit
dc66960f84
@ -122,7 +122,7 @@ class RegisterEventListenersAndSubscribersPass implements CompilerPassInterface
|
|||||||
}
|
}
|
||||||
$instance['event'] = array($instance['event']);
|
$instance['event'] = array($instance['event']);
|
||||||
|
|
||||||
if (isset($instance['lazy']) && $instance['lazy']) {
|
if ($lazy = !empty($instance['lazy'])) {
|
||||||
$this->container->getDefinition($id)->setPublic(true);
|
$this->container->getDefinition($id)->setPublic(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -446,6 +446,31 @@ class Filesystem
|
|||||||
$startPathArr = explode('/', trim($startPath, '/'));
|
$startPathArr = explode('/', trim($startPath, '/'));
|
||||||
$endPathArr = explode('/', trim($endPath, '/'));
|
$endPathArr = explode('/', trim($endPath, '/'));
|
||||||
|
|
||||||
|
if ('/' !== $startPath[0]) {
|
||||||
|
array_shift($startPathArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('/' !== $endPath[0]) {
|
||||||
|
array_shift($endPathArr);
|
||||||
|
}
|
||||||
|
|
||||||
|
$normalizePathArray = function ($pathSegments) {
|
||||||
|
$result = array();
|
||||||
|
|
||||||
|
foreach ($pathSegments as $segment) {
|
||||||
|
if ('..' === $segment) {
|
||||||
|
array_pop($result);
|
||||||
|
} else {
|
||||||
|
$result[] = $segment;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
};
|
||||||
|
|
||||||
|
$startPathArr = $normalizePathArray($startPathArr);
|
||||||
|
$endPathArr = $normalizePathArray($endPathArr);
|
||||||
|
|
||||||
// Find for which directory the common path stops
|
// Find for which directory the common path stops
|
||||||
$index = 0;
|
$index = 0;
|
||||||
while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
|
while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
|
||||||
|
@ -1117,6 +1117,16 @@ class FilesystemTest extends FilesystemTestCase
|
|||||||
array('/a/aab/bb/', '/b/aab', '../../a/aab/bb/'),
|
array('/a/aab/bb/', '/b/aab', '../../a/aab/bb/'),
|
||||||
array('/aab/bb', '/aa', '../aab/bb/'),
|
array('/aab/bb', '/aa', '../aab/bb/'),
|
||||||
array('/aab', '/aa', '../aab/'),
|
array('/aab', '/aa', '../aab/'),
|
||||||
|
array('/aa/bb/cc', '/aa/dd/..', 'bb/cc/'),
|
||||||
|
array('/aa/../bb/cc', '/aa/dd/..', '../bb/cc/'),
|
||||||
|
array('/aa/bb/../../cc', '/aa/../dd/..', 'cc/'),
|
||||||
|
array('/../aa/bb/cc', '/aa/dd/..', 'bb/cc/'),
|
||||||
|
array('/../../aa/../bb/cc', '/aa/dd/..', '../bb/cc/'),
|
||||||
|
array('C:/aa/bb/cc', 'C:/aa/dd/..', 'bb/cc/'),
|
||||||
|
array('c:/aa/../bb/cc', 'c:/aa/dd/..', '../bb/cc/'),
|
||||||
|
array('C:/aa/bb/../../cc', 'C:/aa/../dd/..', 'cc/'),
|
||||||
|
array('C:/../aa/bb/cc', 'C:/aa/dd/..', 'bb/cc/'),
|
||||||
|
array('C:/../../aa/../bb/cc', 'C:/aa/dd/..', '../bb/cc/'),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ('\\' === DIRECTORY_SEPARATOR) {
|
if ('\\' === DIRECTORY_SEPARATOR) {
|
||||||
|
@ -58,9 +58,9 @@ class MockArraySessionStorage implements SessionStorageInterface
|
|||||||
protected $metadataBag;
|
protected $metadataBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array|SessionBagInterface[]
|
||||||
*/
|
*/
|
||||||
protected $bags;
|
protected $bags = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
|
@ -97,6 +97,30 @@ class MockArraySessionStorageTest extends TestCase
|
|||||||
$this->assertNotEquals('', $this->storage->getId());
|
$this->assertNotEquals('', $this->storage->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testClearClearsBags()
|
||||||
|
{
|
||||||
|
$this->storage->clear();
|
||||||
|
|
||||||
|
$this->assertSame(array(), $this->storage->getBag('attributes')->all());
|
||||||
|
$this->assertSame(array(), $this->storage->getBag('flashes')->peekAll());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testClearStartsSession()
|
||||||
|
{
|
||||||
|
$this->storage->clear();
|
||||||
|
|
||||||
|
$this->assertTrue($this->storage->isStarted());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testClearWithNoBagsStartsSession()
|
||||||
|
{
|
||||||
|
$storage = new MockArraySessionStorage();
|
||||||
|
|
||||||
|
$storage->clear();
|
||||||
|
|
||||||
|
$this->assertTrue($storage->isStarted());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \RuntimeException
|
* @expectedException \RuntimeException
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user