Skip to content

Commit d401385

Browse files
committed
Merge remote-tracking branch 'origin/master' into 0.8
2 parents c212a9e + ffc9807 commit d401385

File tree

6 files changed

+36
-19
lines changed

6 files changed

+36
-19
lines changed

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ matrix:
1616
- php: 7.0
1717
env: SYMFONY_VERSION=2.8.* UNIT_TESTS=true
1818
- php: 5.6
19-
env: SYMFONY_VERSION=3.0.* UNIT_TESTS=true SYMFONY_DEPRECATIONS_HELPER=weak
19+
env: SYMFONY_VERSION=3.0.* UNIT_TESTS=true
2020
- php: 7.0
21-
env: SYMFONY_VERSION=3.0.* UNIT_TESTS=true SYMFONY_DEPRECATIONS_HELPER=weak
21+
env: SYMFONY_VERSION=3.0.* UNIT_TESTS=true
2222
- php: 7.1
2323
services: docker
2424
env: SYMFONY_VERSION=2.8.* FUNCTIONAL_TESTS=true

CHANGELOG.md

+15
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
# Change Log
22

3+
## [0.7.17](https://github.com/php-enqueue/enqueue-dev/tree/0.7.17) (2017-10-03)
4+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.7.16...0.7.17)
5+
6+
- \[Symfony\] Error using profiler with symfony 2.8 [\#211](https://github.com/php-enqueue/enqueue-dev/issues/211)
7+
- \[fs\] ErrorException: The Symfony\Component\Filesystem\LockHandler class is deprecated since version 3.4 [\#166](https://github.com/php-enqueue/enqueue-dev/issues/166)
8+
- Fs do not throw error on user deprecate [\#214](https://github.com/php-enqueue/enqueue-dev/pull/214) ([makasim](https://github.com/makasim))
9+
- \[bundle\]\[profiler\] Fix array to string conversion notice. [\#212](https://github.com/php-enqueue/enqueue-dev/pull/212) ([makasim](https://github.com/makasim))
10+
11+
## [0.7.16](https://github.com/php-enqueue/enqueue-dev/tree/0.7.16) (2017-09-28)
12+
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.7.15...0.7.16)
13+
14+
- Fixes the notation for Twig template names in the data collector [\#207](https://github.com/php-enqueue/enqueue-dev/pull/207) ([Lctrs](https://github.com/Lctrs))
15+
16+
- \[BC Break\]\[dsn\] replace xxx:// to xxx: [\#205](https://github.com/php-enqueue/enqueue-dev/pull/205) ([makasim](https://github.com/makasim))
17+
318
## [0.7.15](https://github.com/php-enqueue/enqueue-dev/tree/0.7.15) (2017-09-25)
419
[Full Changelog](https://github.com/php-enqueue/enqueue-dev/compare/0.7.14...0.7.15)
520

pkg/enqueue-bundle/Profiler/MessageQueueCollector.php

+4-9
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Enqueue\Client\MessagePriority;
66
use Enqueue\Client\ProducerInterface;
77
use Enqueue\Client\TraceableProducer;
8+
use Enqueue\Util\JSON;
89
use Symfony\Component\HttpFoundation\Request;
910
use Symfony\Component\HttpFoundation\Response;
1011
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
@@ -65,19 +66,13 @@ public function prettyPrintPriority($priority)
6566
}
6667

6768
/**
68-
* @param string $message
69+
* @param mixed $body
6970
*
7071
* @return string
7172
*/
72-
public function prettyPrintMessage($message)
73+
public function ensureString($body)
7374
{
74-
if (is_scalar($message)) {
75-
return htmlspecialchars($message);
76-
}
77-
78-
return htmlspecialchars(
79-
json_encode($message, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)
80-
);
75+
return is_string($body) ? $body : JSON::encode($body);
8176
}
8277

8378
/**

pkg/enqueue-bundle/Resources/views/Profiler/panel.html.twig

+4-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@
4444
<td>{{ sentMessage.topic }}</td>
4545
<td style="width: 70%">
4646
<span class="metadata">
47-
<span>{{ sentMessage.body[0:40] }}... </span><a class="btn btn-link text-small sf-toggle" data-toggle-selector="#message-body-{{ loop.index }}" data-toggle-alt-content="Hide trace">Show trace</a>
47+
<span>
48+
{{ collector.ensureString(sentMessage.body)[0:40] }}{% if collector.ensureString(sentMessage.body)[0:40] != collector.ensureString(sentMessage.body) %}...{% endif %}
49+
</span>
50+
<a class="btn btn-link text-small sf-toggle" data-toggle-selector="#message-body-{{ loop.index }}" data-toggle-alt-content="Hide trace">Show trace</a>
4851

4952
<div id="message-body-{{ loop.index }}" class="context sf-toggle-content sf-toggle-hidden">
5053
{{ profiler_dump(sentMessage.body) }}

pkg/enqueue-bundle/Tests/Unit/Profiler/MessageQueueCollectorTest.php

+5-7
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,19 @@ public function testShouldPrettyPrintUnknownPriority()
7171
$this->assertEquals('unknownPriority', $collector->prettyPrintPriority('unknownPriority'));
7272
}
7373

74-
public function testShouldPrettyPrintScalarMessage()
74+
public function testShouldEnsureStringKeepStringSame()
7575
{
7676
$collector = new MessageQueueCollector($this->createProducerMock());
7777

78-
$this->assertEquals('foo', $collector->prettyPrintMessage('foo'));
79-
$this->assertEquals('&lt;p&gt;', $collector->prettyPrintMessage('<p>'));
78+
$this->assertEquals('foo', $collector->ensureString('foo'));
79+
$this->assertEquals('bar baz', $collector->ensureString('bar baz'));
8080
}
8181

82-
public function testShouldPrettyPrintArrayMessage()
82+
public function testShouldEnsureStringEncodeArrayToJson()
8383
{
8484
$collector = new MessageQueueCollector($this->createProducerMock());
8585

86-
$expected = "[\n &quot;foo&quot;,\n &quot;bar&quot;\n]";
87-
88-
$this->assertEquals($expected, $collector->prettyPrintMessage(['foo', 'bar']));
86+
$this->assertEquals('["foo","bar"]', $collector->ensureString(['foo', 'bar']));
8987
}
9088

9189
/**

pkg/fs/FsContext.php

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Enqueue\Fs;
44

5+
use Doctrine\ORM\Cache\Lock;
56
use Interop\Queue\InvalidDestinationException;
67
use Interop\Queue\PsrContext;
78
use Interop\Queue\PsrDestination;
@@ -94,6 +95,11 @@ public function declareDestination(PsrDestination $destination)
9495
InvalidDestinationException::assertDestinationInstanceOf($destination, FsDestination::class);
9596

9697
set_error_handler(function ($severity, $message, $file, $line) {
98+
// do not throw on a deprecation notice.
99+
if (E_USER_DEPRECATED === $severity && false !== strpos($message, LockHandler::class)) {
100+
return;
101+
}
102+
97103
throw new \ErrorException($message, 0, $severity, $file, $line);
98104
});
99105

0 commit comments

Comments
 (0)