Update v1.0.6.5
This commit is contained in:
@@ -235,12 +235,12 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
||||
private function preProcess($eventName)
|
||||
{
|
||||
foreach ($this->dispatcher->getListeners($eventName) as $listener) {
|
||||
$this->dispatcher->removeListener($eventName, $listener);
|
||||
$info = $this->getListenerInfo($listener, $eventName);
|
||||
$name = isset($info['class']) ? $info['class'] : $info['type'];
|
||||
$wrappedListener = new WrappedListener($listener, $name, $this->stopwatch, $this);
|
||||
$this->wrappedListeners[$eventName][] = $wrappedListener;
|
||||
$this->dispatcher->addListener($eventName, $wrappedListener);
|
||||
$this->dispatcher->removeListener($eventName, $listener);
|
||||
$this->dispatcher->addListener($eventName, $wrappedListener, $info['priority']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,8 +253,9 @@ class TraceableEventDispatcher implements TraceableEventDispatcherInterface
|
||||
continue;
|
||||
}
|
||||
// Unwrap listener
|
||||
$priority = $this->getListenerPriority($eventName, $listener);
|
||||
$this->dispatcher->removeListener($eventName, $listener);
|
||||
$this->dispatcher->addListener($eventName, $listener->getWrappedListener());
|
||||
$this->dispatcher->addListener($eventName, $listener->getWrappedListener(), $priority);
|
||||
|
||||
$info = $this->getListenerInfo($listener->getWrappedListener(), $eventName);
|
||||
if ($listener->wasCalled()) {
|
||||
|
@@ -59,6 +59,18 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
||||
->with($event)
|
||||
;
|
||||
|
||||
$service
|
||||
->expects($this->once())
|
||||
->method('onEventWithPriority')
|
||||
->with($event)
|
||||
;
|
||||
|
||||
$service
|
||||
->expects($this->once())
|
||||
->method('onEventNested')
|
||||
->with($event)
|
||||
;
|
||||
|
||||
$container = new Container();
|
||||
$container->set('service.subscriber', $service);
|
||||
|
||||
@@ -66,6 +78,8 @@ class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest
|
||||
$dispatcher->addSubscriberService('service.subscriber', 'Symfony\Component\EventDispatcher\Tests\SubscriberService');
|
||||
|
||||
$dispatcher->dispatch('onEvent', $event);
|
||||
$dispatcher->dispatch('onEventWithPriority', $event);
|
||||
$dispatcher->dispatch('onEventNested', $event);
|
||||
}
|
||||
|
||||
public function testPreventDuplicateListenerService()
|
||||
@@ -243,11 +257,21 @@ class SubscriberService implements EventSubscriberInterface
|
||||
public static function getSubscribedEvents()
|
||||
{
|
||||
return array(
|
||||
'onEvent' => array('onEvent'),
|
||||
'onEvent' => 'onEvent',
|
||||
'onEventWithPriority' => array('onEventWithPriority', 10),
|
||||
'onEventNested' => array(array('onEventNested')),
|
||||
);
|
||||
}
|
||||
|
||||
public function onEvent(Event $e)
|
||||
{
|
||||
}
|
||||
|
||||
public function onEventWithPriority(Event $e)
|
||||
{
|
||||
}
|
||||
|
||||
public function onEventNested(Event $e)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@@ -56,6 +56,23 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($tdispatcher->hasListeners('foo'));
|
||||
}
|
||||
|
||||
public function testGetListenerPriority()
|
||||
{
|
||||
$dispatcher = new EventDispatcher();
|
||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
||||
|
||||
$tdispatcher->addListener('foo', function () {}, 123);
|
||||
|
||||
$listeners = $dispatcher->getListeners('foo');
|
||||
$this->assertSame(123, $tdispatcher->getListenerPriority('foo', $listeners[0]));
|
||||
|
||||
// Verify that priority is preserved when listener is removed and re-added
|
||||
// in preProcess() and postProcess().
|
||||
$tdispatcher->dispatch('foo', new Event());
|
||||
$listeners = $dispatcher->getListeners('foo');
|
||||
$this->assertSame(123, $tdispatcher->getListenerPriority('foo', $listeners[0]));
|
||||
}
|
||||
|
||||
public function testAddRemoveSubscriber()
|
||||
{
|
||||
$dispatcher = new EventDispatcher();
|
||||
@@ -138,12 +155,12 @@ class TraceableEventDispatcherTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
$dispatcher = new EventDispatcher();
|
||||
$tdispatcher = new TraceableEventDispatcher($dispatcher, new Stopwatch());
|
||||
$tdispatcher->addListener('foo', $listener1 = function () use (&$called) { $called[] = 'foo1'; });
|
||||
$tdispatcher->addListener('foo', $listener2 = function () use (&$called) { $called[] = 'foo2'; });
|
||||
$tdispatcher->addListener('foo', function () use (&$called) { $called[] = 'foo1'; }, 10);
|
||||
$tdispatcher->addListener('foo', function () use (&$called) { $called[] = 'foo2'; }, 20);
|
||||
|
||||
$tdispatcher->dispatch('foo');
|
||||
|
||||
$this->assertEquals(array('foo1', 'foo2'), $called);
|
||||
$this->assertSame(array('foo2', 'foo1'), $called);
|
||||
}
|
||||
|
||||
public function testDispatchNested()
|
||||
|
24
vendor/symfony/filesystem/Filesystem.php
vendored
24
vendor/symfony/filesystem/Filesystem.php
vendored
@@ -115,6 +115,10 @@ class Filesystem
|
||||
public function exists($files)
|
||||
{
|
||||
foreach ($this->toIterator($files) as $file) {
|
||||
if ('\\' === DIRECTORY_SEPARATOR && strlen($file) > 258) {
|
||||
throw new IOException('Could not check if file exist because path length exceeds 258 characters.', 0, null, $file);
|
||||
}
|
||||
|
||||
if (!file_exists($file)) {
|
||||
return false;
|
||||
}
|
||||
@@ -154,7 +158,7 @@ class Filesystem
|
||||
$files = iterator_to_array($this->toIterator($files));
|
||||
$files = array_reverse($files);
|
||||
foreach ($files as $file) {
|
||||
if (!file_exists($file) && !is_link($file)) {
|
||||
if (!$this->exists($file) && !is_link($file)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -268,7 +272,7 @@ class Filesystem
|
||||
public function rename($origin, $target, $overwrite = false)
|
||||
{
|
||||
// we check that target does not exist
|
||||
if (!$overwrite && is_readable($target)) {
|
||||
if (!$overwrite && $this->isReadable($target)) {
|
||||
throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
|
||||
}
|
||||
|
||||
@@ -277,6 +281,22 @@ class Filesystem
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether a file exists and is readable.
|
||||
*
|
||||
* @param string $filename Path to the file.
|
||||
*
|
||||
* @throws IOException When windows path is longer than 258 characters
|
||||
*/
|
||||
private function isReadable($filename)
|
||||
{
|
||||
if ('\\' === DIRECTORY_SEPARATOR && strlen($filename) > 258) {
|
||||
throw new IOException('Could not check if file is readable because path length exceeds 258 characters.', 0, null, $filename);
|
||||
}
|
||||
|
||||
return is_readable($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a symbolic link or copy a directory.
|
||||
*
|
||||
|
2
vendor/symfony/filesystem/LockHandler.php
vendored
2
vendor/symfony/filesystem/LockHandler.php
vendored
@@ -69,7 +69,7 @@ class LockHandler
|
||||
}
|
||||
|
||||
// Silence error reporting
|
||||
set_error_handler(function() {});
|
||||
set_error_handler(function () {});
|
||||
|
||||
if (!$this->handle = fopen($this->file, 'r')) {
|
||||
if ($this->handle = fopen($this->file, 'x')) {
|
||||
|
@@ -358,6 +358,28 @@ class FilesystemTest extends FilesystemTestCase
|
||||
$this->assertTrue($this->filesystem->exists($basePath.'folder'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Filesystem\Exception\IOException
|
||||
*/
|
||||
public function testFilesExistsFails()
|
||||
{
|
||||
if ('\\' !== DIRECTORY_SEPARATOR) {
|
||||
$this->markTestSkipped('Test covers edge case on Windows only.');
|
||||
}
|
||||
|
||||
$basePath = $this->workspace.'\\directory\\';
|
||||
|
||||
$oldPath = getcwd();
|
||||
mkdir($basePath);
|
||||
chdir($basePath);
|
||||
$file = str_repeat('T', 259 - strlen($basePath));
|
||||
$path = $basePath.$file;
|
||||
exec('TYPE NUL >>'.$file); // equivalent of touch, we can not use the php touch() here because it suffers from the same limitation
|
||||
self::$longPathNamesWindows[] = $path; // save this so we can clean up later
|
||||
chdir($oldPath);
|
||||
$this->filesystem->exists($path);
|
||||
}
|
||||
|
||||
public function testFilesExistsTraversableObjectOfFilesAndDirectories()
|
||||
{
|
||||
$basePath = $this->workspace.DIRECTORY_SEPARATOR;
|
||||
@@ -893,7 +915,7 @@ class FilesystemTest extends FilesystemTestCase
|
||||
|
||||
public function testMirrorCopiesLinkedDirectoryContents()
|
||||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
$this->markAsSkippedIfSymlinkIsMissing(true);
|
||||
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
|
||||
@@ -913,7 +935,7 @@ class FilesystemTest extends FilesystemTestCase
|
||||
|
||||
public function testMirrorCopiesRelativeLinkedContents()
|
||||
{
|
||||
$this->markAsSkippedIfSymlinkIsMissing();
|
||||
$this->markAsSkippedIfSymlinkIsMissing(true);
|
||||
|
||||
$sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR;
|
||||
$oldPath = getcwd();
|
||||
@@ -1005,7 +1027,6 @@ class FilesystemTest extends FilesystemTestCase
|
||||
|
||||
// The compress.zlib:// stream does not support mode x: creates the file, errors "failed to open stream: operation failed" and returns false
|
||||
$this->filesystem->tempnam($dirname, 'bar');
|
||||
|
||||
}
|
||||
|
||||
public function testTempnamWithPHPTempSchemeFails()
|
||||
@@ -1151,8 +1172,8 @@ class FilesystemTest extends FilesystemTestCase
|
||||
{
|
||||
$this->markAsSkippedIfChmodIsMissing();
|
||||
|
||||
$sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file';
|
||||
$targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file';
|
||||
$sourceFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_source_file';
|
||||
$targetFilePath = $this->workspace . DIRECTORY_SEPARATOR . 'copy_target_file';
|
||||
|
||||
file_put_contents($sourceFilePath, 'SOURCE FILE');
|
||||
chmod($sourceFilePath, 0745);
|
||||
|
@@ -17,6 +17,8 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
private $umask;
|
||||
|
||||
static protected $longPathNamesWindows = array();
|
||||
|
||||
/**
|
||||
* @var \Symfony\Component\Filesystem\Filesystem
|
||||
*/
|
||||
@@ -31,6 +33,12 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public static function setUpBeforeClass()
|
||||
{
|
||||
if (!empty(self::$longPathNamesWindows)) {
|
||||
foreach (self::$longPathNamesWindows as $path) {
|
||||
exec('DEL '.$path);
|
||||
}
|
||||
}
|
||||
|
||||
if ('\\' === DIRECTORY_SEPARATOR && null === self::$symlinkOnWindows) {
|
||||
$target = tempnam(sys_get_temp_dir(), 'sl');
|
||||
$link = sys_get_temp_dir().'/sl'.microtime(true).mt_rand();
|
||||
@@ -92,7 +100,7 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
|
||||
$this->markTestSkipped('Unable to retrieve file group name');
|
||||
}
|
||||
|
||||
protected function markAsSkippedIfSymlinkIsMissing()
|
||||
protected function markAsSkippedIfSymlinkIsMissing($relative = false)
|
||||
{
|
||||
if (!function_exists('symlink')) {
|
||||
$this->markTestSkipped('Function symlink is required.');
|
||||
@@ -101,6 +109,11 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
|
||||
if ('\\' === DIRECTORY_SEPARATOR && false === self::$symlinkOnWindows) {
|
||||
$this->markTestSkipped('symlink requires "Create symbolic links" privilege on Windows');
|
||||
}
|
||||
|
||||
// https://bugs.php.net/bug.php?id=69473
|
||||
if ($relative && '\\' === DIRECTORY_SEPARATOR && 1 === PHP_ZTS) {
|
||||
$this->markTestSkipped('symlink does not support relative paths on thread safe Windows PHP versions');
|
||||
}
|
||||
}
|
||||
|
||||
protected function markAsSkippedIfChmodIsMissing()
|
||||
|
7
vendor/symfony/yaml/Inline.php
vendored
7
vendor/symfony/yaml/Inline.php
vendored
@@ -519,7 +519,12 @@ class Inline
|
||||
case preg_match('/^(-|\+)?[0-9,]+(\.[0-9]+)?$/', $scalar):
|
||||
return (float) str_replace(',', '', $scalar);
|
||||
case preg_match(self::getTimestampRegex(), $scalar):
|
||||
return strtotime($scalar);
|
||||
$timeZone = date_default_timezone_get();
|
||||
date_default_timezone_set('UTC');
|
||||
$time = strtotime($scalar);
|
||||
date_default_timezone_set($timeZone);
|
||||
|
||||
return $time;
|
||||
}
|
||||
default:
|
||||
return (string) $scalar;
|
||||
|
10
vendor/symfony/yaml/Parser.php
vendored
10
vendor/symfony/yaml/Parser.php
vendored
@@ -301,8 +301,14 @@ class Parser
|
||||
mb_internal_encoding($mbEncoding);
|
||||
}
|
||||
|
||||
if ($objectForMap && !is_object($data)) {
|
||||
$data = (object) $data;
|
||||
if ($objectForMap && !is_object($data) && 'mapping' === $context) {
|
||||
$object = new \stdClass();
|
||||
|
||||
foreach ($data as $key => $value) {
|
||||
$object->$key = $value;
|
||||
}
|
||||
|
||||
$data = $object;
|
||||
}
|
||||
|
||||
return empty($data) ? null : $data;
|
||||
|
@@ -754,7 +754,7 @@ yaml: |
|
||||
Billsmer @ 338-4338.
|
||||
php: |
|
||||
array(
|
||||
'invoice' => 34843, 'date' => mktime(0, 0, 0, 1, 23, 2001),
|
||||
'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
|
||||
'bill-to' =>
|
||||
array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) )
|
||||
, 'ship-to' =>
|
||||
@@ -879,7 +879,7 @@ yaml: |
|
||||
php: |
|
||||
array(
|
||||
'invoice' => 34843,
|
||||
'date' => mktime(0, 0, 0, 1, 23, 2001),
|
||||
'date' => gmmktime(0, 0, 0, 1, 23, 2001),
|
||||
'total' => 4443.52
|
||||
)
|
||||
---
|
||||
|
4
vendor/symfony/yaml/Tests/InlineTest.php
vendored
4
vendor/symfony/yaml/Tests/InlineTest.php
vendored
@@ -251,7 +251,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
array("'on'", 'on'),
|
||||
array("'off'", 'off'),
|
||||
|
||||
array('2007-10-30', mktime(0, 0, 0, 10, 30, 2007)),
|
||||
array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
|
||||
array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
|
||||
array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
|
||||
array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
|
||||
@@ -318,7 +318,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
array("'#cfcfcf'", '#cfcfcf'),
|
||||
array('::form_base.html.twig', '::form_base.html.twig'),
|
||||
|
||||
array('2007-10-30', mktime(0, 0, 0, 10, 30, 2007)),
|
||||
array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
|
||||
array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
|
||||
array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
|
||||
array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
|
||||
|
76
vendor/symfony/yaml/Tests/ParserTest.php
vendored
76
vendor/symfony/yaml/Tests/ParserTest.php
vendored
@@ -442,35 +442,75 @@ EOF;
|
||||
$this->assertEquals(array('foo' => null, 'bar' => 1), $this->parser->parse($input), '->parse() does not parse objects');
|
||||
}
|
||||
|
||||
public function testObjectForMapEnabledWithMapping()
|
||||
/**
|
||||
* @dataProvider getObjectForMapTests
|
||||
*/
|
||||
public function testObjectForMap($yaml, $expected)
|
||||
{
|
||||
$this->assertEquals($expected, $this->parser->parse($yaml, false, false, true));
|
||||
}
|
||||
|
||||
public function getObjectForMapTests()
|
||||
{
|
||||
$tests = array();
|
||||
|
||||
$yaml = <<<EOF
|
||||
foo:
|
||||
fiz: [cat]
|
||||
EOF;
|
||||
$result = $this->parser->parse($yaml, false, false, true);
|
||||
$expected = new \stdClass();
|
||||
$expected->foo = new \stdClass();
|
||||
$expected->foo->fiz = array('cat');
|
||||
$tests['mapping'] = array($yaml, $expected);
|
||||
|
||||
$this->assertInstanceOf('stdClass', $result);
|
||||
$this->assertInstanceOf('stdClass', $result->foo);
|
||||
$this->assertEquals(array('cat'), $result->foo->fiz);
|
||||
}
|
||||
$yaml = '{ "foo": "bar", "fiz": "cat" }';
|
||||
$expected = new \stdClass();
|
||||
$expected->foo = 'bar';
|
||||
$expected->fiz = 'cat';
|
||||
$tests['inline-mapping'] = array($yaml, $expected);
|
||||
|
||||
public function testObjectForMapEnabledWithInlineMapping()
|
||||
{
|
||||
$result = $this->parser->parse('{ "foo": "bar", "fiz": "cat" }', false, false, true);
|
||||
|
||||
$this->assertInstanceOf('stdClass', $result);
|
||||
$this->assertEquals('bar', $result->foo);
|
||||
$this->assertEquals('cat', $result->fiz);
|
||||
}
|
||||
|
||||
public function testObjectForMapIsAppliedAfterParsing()
|
||||
{
|
||||
$yaml = "foo: bar\nbaz: foobar";
|
||||
$expected = new \stdClass();
|
||||
$expected->foo = 'bar';
|
||||
$expected->baz = 'foobar';
|
||||
$tests['object-for-map-is-applied-after-parsing'] = array($yaml, $expected);
|
||||
|
||||
$this->assertEquals($expected, $this->parser->parse("foo: bar\nbaz: foobar", false, false, true));
|
||||
$yaml = <<<EOT
|
||||
array:
|
||||
- key: one
|
||||
- key: two
|
||||
EOT;
|
||||
$expected = new \stdClass();
|
||||
$expected->array = array();
|
||||
$expected->array[0] = new \stdClass();
|
||||
$expected->array[0]->key = 'one';
|
||||
$expected->array[1] = new \stdClass();
|
||||
$expected->array[1]->key = 'two';
|
||||
$tests['nest-map-and-sequence'] = array($yaml, $expected);
|
||||
|
||||
$yaml = <<<YAML
|
||||
map:
|
||||
1: one
|
||||
2: two
|
||||
YAML;
|
||||
$expected = new \stdClass();
|
||||
$expected->map = new \stdClass();
|
||||
$expected->map->{1} = 'one';
|
||||
$expected->map->{2} = 'two';
|
||||
$tests['numeric-keys'] = array($yaml, $expected);
|
||||
|
||||
$yaml = <<<YAML
|
||||
map:
|
||||
0: one
|
||||
1: two
|
||||
YAML;
|
||||
$expected = new \stdClass();
|
||||
$expected->map = new \stdClass();
|
||||
$expected->map->{0} = 'one';
|
||||
$expected->map->{1} = 'two';
|
||||
$tests['zero-indexed-numeric-keys'] = array($yaml, $expected);
|
||||
|
||||
return $tests;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user