Skip to content

Commit dd4d46a

Browse files
committed
add limit to logger explosion
This limit is required to display complete query with e.g. "array" type in it.
1 parent cd56d09 commit dd4d46a

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

src/Symfony/Bridge/Propel1/DataCollector/PropelDataCollector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ private function buildQueries()
116116
$innerGlue = $this->propelConfiguration->getParameter('debugpdo.logging.innerglue', ': ');
117117

118118
foreach ($this->logger->getQueries() as $q) {
119-
$parts = explode($outerGlue, $q);
119+
$parts = explode($outerGlue, $q, 4);
120120

121121
$times = explode($innerGlue, $parts[0]);
122122
$con = explode($innerGlue, $parts[2]);

tests/Symfony/Tests/Bridge/Propel1/DataCollector/PropelDataCollectorTest.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public function testCollectWithMultipleData()
5151
{
5252
$queries = array(
5353
"time: 0.000 sec | mem: 1.4 MB | connection: default | SET NAMES 'utf8'",
54-
"time: 0.012 sec | mem: 2.4 MB | connection: default | SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12"
54+
"time: 0.012 sec | mem: 2.4 MB | connection: default | SELECT tags.NAME, image.FILENAME FROM tags LEFT JOIN image ON tags.IMAGEID = image.ID WHERE image.ID = 12",
55+
"time: 0.012 sec | mem: 2.4 MB | connection: default | INSERT INTO `table` (`some_array`) VALUES ('| 1 | 2 | 3 |')",
5556
);
5657

5758
$c = $this->createCollector($queries);
@@ -69,10 +70,16 @@ public function testCollectWithMultipleData()
6970
'time' => '0.012 sec',
7071
'connection'=> 'default',
7172
'memory' => '2.4 MB'
72-
)
73+
),
74+
array(
75+
'sql' => "INSERT INTO `table` (`some_array`) VALUES ('| 1 | 2 | 3 |')",
76+
'time' => '0.012 sec',
77+
'connection'=> 'default',
78+
'memory' => '2.4 MB'
79+
),
7380
), $c->getQueries());
74-
$this->assertEquals(2, $c->getQueryCount());
75-
$this->assertEquals(0.012, $c->getTime());
81+
$this->assertEquals(3, $c->getQueryCount());
82+
$this->assertEquals(0.024, $c->getTime());
7683
}
7784

7885
private function createCollector($queries)

0 commit comments

Comments
 (0)