Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7cc4cab

Browse filesBrowse files
committed
bug #32173 [FrameworkBundle] Fix calling Client::getProfile() before sending a request (dunglas)
This PR was merged into the 3.4 branch. Discussion ---------- [FrameworkBundle] Fix calling Client::getProfile() before sending a request | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | n/a | License | MIT | Doc PR | n/a Prevent throwing an error when calling getProfile before a request has been sent. Commits ------- 9e6f4b2 [FrameworkBundle] Fix calling Client::getProfile() before sending a request
2 parents 28b20b8 + 9e6f4b2 commit 7cc4cab
Copy full SHA for 7cc4cab

File tree

Expand file treeCollapse file tree

2 files changed

+4
-4
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-4
lines changed

‎src/Symfony/Bundle/FrameworkBundle/Client.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Client.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function getKernel()
6666
*/
6767
public function getProfile()
6868
{
69-
if (!$this->kernel->getContainer()->has('profiler')) {
69+
if (null === $this->response || !$this->kernel->getContainer()->has('profiler')) {
7070
return false;
7171
}
7272

‎src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/FrameworkBundle/Tests/Functional/ProfilerTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public function testProfilerIsDisabled($insulate)
2828

2929
// enable the profiler for the next request
3030
$client->enableProfiler();
31-
$crawler = $client->request('GET', '/profiler');
32-
$profile = $client->getProfile();
33-
$this->assertInternalType('object', $profile);
31+
$this->assertFalse($client->getProfile());
32+
$client->request('GET', '/profiler');
33+
$this->assertInternalType('object', $client->getProfile());
3434

3535
$client->request('GET', '/profiler');
3636
$this->assertFalse($client->getProfile());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.