From 4f4c679eef28ac6f87927cc1a35a8aeef12f6f02 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Sun, 1 Jul 2012 23:01:26 +0200 Subject: [PATCH] [FrameworkBundle] fixed client insulation (closes #1726, closes #4608) --- src/Symfony/Bundle/FrameworkBundle/Client.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Client.php b/src/Symfony/Bundle/FrameworkBundle/Client.php index 9898f490cf..cd6309b0bc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Client.php +++ b/src/Symfony/Bundle/FrameworkBundle/Client.php @@ -84,6 +84,11 @@ class Client extends BaseClient /** * Returns the script to execute when the request must be insulated. * + * It assumes that the autoloader is named 'autoload.php' and that it is + * stored in the same directory as the kernel (this is the case for the + * Symfony Standard Edition). If this is not your case, create your own + * client and override this method. + * * @param Request $request A Request instance * * @return string The script content @@ -94,11 +99,22 @@ class Client extends BaseClient $request = str_replace("'", "\\'", serialize($request)); $r = new \ReflectionObject($this->kernel); + + $autoloader = dirname($r->getFileName()).'/autoload.php'; + if (is_file($autoloader)) { + $autoloader = str_replace("'", "\\'", $autoloader); + } else { + $autoloader = ''; + } + $path = str_replace("'", "\\'", $r->getFileName()); return <<