Skip to content

Commit ca0fedd

Browse files
[BrowserKit] Handle deprecations triggered in insulated requests
1 parent ff379ef commit ca0fedd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/Symfony/Component/BrowserKit/Client.php

+14
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,23 @@ public function request($method, $uri, array $parameters = array(), array $files
343343
*/
344344
protected function doRequestInProcess($request)
345345
{
346+
$deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec');
347+
putenv('SYMFONY_DEPRECATIONS_SERIALIZE='.$deprecationsFile);
346348
$process = new PhpProcess($this->getScript($request), null, null);
347349
$process->run();
348350

351+
if (file_exists($deprecationsFile)) {
352+
$deprecations = file_get_contents($deprecationsFile);
353+
unlink($deprecationsFile);
354+
foreach ($deprecations ? unserialize($deprecations) : array() as $deprecation) {
355+
if ($deprecation[0]) {
356+
trigger_error($deprecation[1], E_USER_DEPRECATED);
357+
} else {
358+
@trigger_error($deprecation[1], E_USER_DEPRECATED);
359+
}
360+
}
361+
}
362+
349363
if (!$process->isSuccessful() || !preg_match('/^O\:\d+\:/', $process->getOutput())) {
350364
throw new \RuntimeException(sprintf('OUTPUT: %s ERROR OUTPUT: %s', $process->getOutput(), $process->getErrorOutput()));
351365
}

0 commit comments

Comments
 (0)