8000 Merge branch '2.0' · proofek/symfony@83b24c5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 83b24c5

Browse files
committed
Merge branch '2.0'
* 2.0: changed the way we store the current ob level (refs symfony#2617)
2 parents b8e0f41 + bb5fb79 commit 83b24c5

File tree

5 files changed

+7
-28
lines changed

5 files changed

+7
-28
lines changed

src/Symfony/Bundle/FrameworkBundle/HttpKernel.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ
4141
$this->container->enterScope('request');
4242
$this->container->set('request', $request, 'request');
4343

44+
$request->headers->set('X-Php-Ob-Level', ob_get_level());
45+
4446
try {
4547
$response = parent::handle($request, $type, $catch);
4648
} catch (\Exception $e) {

src/Symfony/Bundle/TwigBundle/Controller/ExceptionController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ protected function getAndCleanOutputBuffering()
6565
// some Windows configurations where ob_get_level()
6666
// never reaches 0
6767
$count = 100;
68-
$startObLevel = $this->container->get('kernel')->getStartObLevel();
68+
$startObLevel = $this->container->get('request')->headers->get('X-Php-Ob-Level', -1);
6969
$currentContent = '';
7070
while (ob_get_level() > $startObLevel && --$count) {
7171
$currentContent .= ob_get_clean();

src/Symfony/Bundle/TwigBundle/Tests/Controller/ExceptionControllerTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
use Symfony\Component\DependencyInjection\ContainerBuilder;
1818
use Symfony\Component\DependencyInjection\Scope;
1919
use Symfony\Component\DependencyInjection\Definition;
20+
use Symfony\Component\HttpFoundation\Request;
2021

2122
class ExceptionControllerTest extends TestCase
2223
{
@@ -48,6 +49,7 @@ protected function setUp()
4849
->expects($this->any())
4950
->method('renderResponse')
5051
->will($this->returnValue($this->getMock('Symfony\Component\HttpFoundation\Response')));
52+
$this->request = Request::create('/');
5153
$this->container = $this->getContainer();
5254
}
5355

@@ -64,12 +66,7 @@ protected function tearDown()
6466

6567
public function testOnlyClearOwnOutputBuffers()
6668
{
67-
$this->container->enterScope('request');
68-
69-
$this->kernel
70-
->expects($this->once())
71-
->method('getStartObLevel')
72-
->will($this->returnValue(1));
69+
$this->request->headers->set('X-Php-Ob-Level', 1);
7370

7471
$this->controller->setContainer($this->container);
7572
$this->controller->showAction($this->flatten);
@@ -79,7 +76,7 @@ private function getContainer()
7976
{
8077
$container = new ContainerBuilder();
8178
$container->addScope(new Scope('request'));
82-
$container->register('request', 'Symfony\\Component\\HttpFoundation\\Request')->setScope('request');
79+
$container->set('request', $this->request);
8380
$container->set('templating', $this->templating);
8481
$container->setParameter('kernel.bundles', array());
8582
$container->setParameter('kernel.cache_dir', __DIR__);

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ abstract class Kernel implements KernelInterface
5555
protected $booted;
5656
protected $name;
5757
protected $startTime;
58-
protected $startObLevel;
5958
protected $classes;
6059

6160
const VERSION = '2.1.0-DEV';
@@ -121,8 +120,6 @@ public function boot()
121120
return;
122121
}
123122

124-
$this->startObLevel = ob_get_level();
125-
126123
// init bundles
127124
$this->initializeBundles();
128125

@@ -424,16 +421,6 @@ public function getStartTime()
424421
return $this->debug ? $this->startTime : -INF;
425422
}
426423

427-
/**
428-
* Gets the ob_level at the start of the request
429-
*
430-
* @return integer The request start ob_level
431-
*/
432-
public function getStartObLevel()
433-
{
434-
return $this->startObLevel;
435-
}
436-
437424
/**
438425
* Gets the cache directory.
439426
*

src/Symfony/Component/HttpKernel/KernelInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,6 @@ function getContainer();
179179
*/
180180
function getStartTime();
181181

182-
/**
183-
* Gets the ob_level at the start of the request
184-
*
185-
* @return integer The request start ob_level
186-
*/
187-
function getStartObLevel();
188-
189182
/**
190183
* Gets the cache directory.
191184
*

0 commit comments

Comments
 (0)
0