This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
Go to file
Fabien Potencier ebea32c40d merged branch guilhermeblanco/patch-9 (PR #4949)
Commits
-------

1f33756 Update master

Discussion
----------

Allow HttpKernel ->render to be called directly

Hi,

I faced this problem in a funny situation.
Working on tests of individual components, I want to be able to test sub-requests. These elements are not mapped directly, relying on `FrameworkBundle` routing internal to achieve its goal.

The nature of my application leads to fully decoupled bundles, being a website responsible to define everything, from app configuration to routing elements. That way, an individual bundle controller don't know the route it should call, leading the test to be harder to do.

Together with this situation, it is also required in my testing scenario to be able to test the real world execution, then being an ESI include (a sub-request). This test then needs to be able to directly call controller to be rendered. That said, `HttpKernel` provides an API that does exactly what is required to achieve my goal, calling `render()` which triggers the sub-request and also accepts options which allows me to test the real world scenarios.
But as soon as you trigger the method, `ProfileListener` intercepts the kernel response to collect profiling information. Under this specific situation, since you called directly `render`, there's no master request, then leading the test to fail with the following PHP warning:

```
Warning: SplObjectStorage::offsetExists() expects parameter 1 to be object, boolean given in /var/www/nde/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/EventListener/ProfilerListener.php line 120
```

To fix that, all that is needed is a check for a possible parent request. That's the purpose of this patch. =)

---------------------------------------------------------------------------

by stof at 2012-07-17T15:11:13Z

This looks good to me, but as said on IRC, a test should be added to avoid regressions
2012-07-18 10:22:46 +02:00
src/Symfony merged branch guilhermeblanco/patch-9 (PR #4949) 2012-07-18 10:22:46 +02:00
.editorconfig Add EditorConfig File 2012-06-16 14:08:15 +02:00
.gitignore ignore composer.phar 2012-04-20 14:10:06 +01:00
.travis.yml Revert "merged branch stof/travis_version (PR #4905)" 2012-07-15 12:13:31 +02:00
autoload.php.dist removed unneeded code 2012-06-30 16:47:41 +02:00
CHANGELOG-2.0.md updated CHANGELOG for 2.0.14 2012-05-17 18:29:55 +02:00
composer.json Revert "raised the minimum version of PHP to 5.3.4 (closes #3856)" 2012-07-15 12:13:51 +02:00
CONTRIBUTORS.md update CONTRIBUTORS for 2.0.14 2012-05-17 18:30:22 +02:00
LICENSE Updated LICENSE files copyright 2012-02-22 10:10:37 +01:00
phpunit.xml.dist Set init.default_locale to 'en' in phpunit.xml.dist 2012-05-11 09:33:42 +02:00
README.md added some warnings about known PHP bugs 2012-07-15 12:19:52 +02:00
UPGRADE-2.1.md merged branch bschussek/performance (PR #4918) 2012-07-18 08:33:15 +02:00

README

Build Status

What is Symfony2?

Symfony2 is a PHP 5.3 full-stack web framework. It is written with speed and flexibility in mind. It allows developers to build better and easy to maintain websites with PHP.

Symfony can be used to develop all kind of websites, from your personal blog to high traffic ones like Dailymotion or Yahoo! Answers.

Requirements

Symfony2 is only supported on PHP 5.3.3 and up.

Be warned that PHP versions before 5.3.8 are known to be buggy and might not work for you:

Installation

The best way to install Symfony2 is to download the Symfony Standard Edition available at http://symfony.com/download.

Documentation

The "Quick Tour" tutorial gives you a first feeling of the framework. If, like us, you think that Symfony2 can help speed up your development and take the quality of your work to the next level, read the official Symfony2 documentation.

Contributing

Symfony2 is an open source, community-driven project. If you'd like to contribute, please read the Contributing Code part of the documentation. If you're submitting a pull request, please follow the guidelines in the Submitting a Patch section.