From ca0fedd9e36fb4265dee06010dd08bfa65cf76cb Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 13 Oct 2017 15:21:24 +0200 Subject: [PATCH] [BrowserKit] Handle deprecations triggered in insulated requests --- src/Symfony/Component/BrowserKit/Client.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/Symfony/Component/BrowserKit/Client.php b/src/Symfony/Component/BrowserKit/Client.php index 2f2b08d818..fb7a254e2c 100644 --- a/src/Symfony/Component/BrowserKit/Client.php +++ b/src/Symfony/Component/BrowserKit/Client.php @@ -343,9 +343,23 @@ abstract class Client */ protected function doRequestInProcess($request) { + $deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec'); + putenv('SYMFONY_DEPRECATIONS_SERIALIZE='.$deprecationsFile); $process = new PhpProcess($this->getScript($request), null, null); $process->run(); + if (file_exists($deprecationsFile)) { + $deprecations = file_get_contents($deprecationsFile); + unlink($deprecationsFile); + foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) { + if ($deprecation[0]) { + trigger_error($deprecation[1], E_USER_DEPRECATED); + } else { + @trigger_error($deprecation[1], E_USER_DEPRECATED); + } + } + } + if (!$process->isSuccessful() || !preg_match('/^O\:\d+\:/', $process->getOutput())) { throw new \RuntimeException(sprintf('OUTPUT: %s ERROR OUTPUT: %s', $process->getOutput(), $process->getErrorOutput())); }