Skip to content

Commit 601c61a

Browse files
committed
Merge branch '2.3' into 2.7
* 2.3: added missing quotes in YAML files [HttpKernel] Add `@group time-sensitive` on some transient tests [DoctrineBridge] Fix issue which prevent the profiler to explain a query Use mb_detect_encoding with $strict = true don't allow to install the split Security packages bumped Symfony version to 2.3.35 updated VERSION for 2.3.34 update CONTRIBUTORS for 2.3.34 updated CHANGELOG for 2.3.34
2 parents b0d0a6f + 91d6b2c commit 601c61a

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

DataCollector/DoctrineDataCollector.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ private function sanitizeQueries($connectionName, $queries)
117117
private function sanitizeQuery($connectionName, $query)
118118
{
119119
$query['explainable'] = true;
120+
if (null === $query['params']) {
121+
$query['params'] = array();
122+
}
120123
if (!is_array($query['params'])) {
121124
$query['params'] = array($query['params']);
122125
}

Tests/DataCollector/DoctrineDataCollectorTest.php

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,25 @@ public function testCollectQueries($param, $types, $expected, $explainable)
7979
$c = $this->createCollector($queries);
8080
$c->collect(new Request(), new Response());
8181

82-
$collected_queries = $c->getQueries();
83-
$this->assertEquals($expected, $collected_queries['default'][0]['params'][0]);
84-
$this->assertEquals($explainable, $collected_queries['default'][0]['explainable']);
82+
$collectedQueries = $c->getQueries();
83+
$this->assertEquals($expected, $collectedQueries['default'][0]['params'][0]);
84+
$this->assertEquals($explainable, $collectedQueries['default'][0]['explainable']);
85+
}
86+
87+
public function testCollectQueryWithNoParams()
88+
{
89+
$queries = array(
90+
array('sql' => 'SELECT * FROM table1', 'params' => array(), 'types' => array(), 'executionMS' => 1),
91+
array('sql' => 'SELECT * FROM table1', 'params' => null, 'types' => null, 'executionMS' => 1),
92+
);
93+
$c = $this->createCollector($queries);
94+
$c->collect(new Request(), new Response());
95+
96+
$collectedQueries = $c->getQueries();
97+
$this->assertEquals(array(), $collectedQueries['default'][0]['params']);
98+
$this->assertTrue($collectedQueries['default'][0]['explainable']);
99+
$this->assertEquals(array(), $collectedQueries['default'][1]['params']);
100+
$this->assertTrue($collectedQueries['default'][1]['explainable']);
85101
}
86102

87103
/**
@@ -96,9 +112,9 @@ public function testSerialization($param, $types, $expected, $explainable)
96112
$c->collect(new Request(), new Response());
97113
$c = unserialize(serialize($c));
98114

99-
$collected_queries = $c->getQueries();
100-
$this->assertEquals($expected, $collected_queries['default'][0]['params'][0]);
101-
$this->assertEquals($explainable, $collected_queries['default'][0]['explainable']);
115+
$collectedQueries = $c->getQueries();
116+
$this->assertEquals($expected, $collectedQueries['default'][0]['params'][0]);
117+
$this->assertEquals($explainable, $collectedQueries['default'][0]['explainable']);
102118
}
103119

104120
public function paramProvider()

Tests/Logger/DbalLoggerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function testLogUTF8LongString()
160160
$dbalLogger
161161
->expects($this->once())
162162
->method('log')
163-
->with('SQL', array('short' => $shortString, 'long' => mb_substr($longString, 0, DbalLogger::MAX_STRING_LENGTH - 6, mb_detect_encoding($longString)).' [...]'))
163+
->with('SQL', array('short' => $shortString, 'long' => mb_substr($longString, 0, DbalLogger::MAX_STRING_LENGTH - 6, 'UTF-8').' [...]'))
164164
;
165165

166166
$dbalLogger->startQuery('SQL', array(

0 commit comments

Comments
 (0)