Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Fix data serialization when using process isolation (closes #614) #616

merged 1 commit into from

2 participants


When setting process isolation to true, PHPUnit creates a script that is executed in another process. In the generated script, it serializes the data to be passed to the test method, and this is where there is an issue.

A simple PHP script that exhibits the same issue:

$a = '\\\\foo';
file_put_contents(__DIR__.'/test.php', sprintf('<?php echo unserialize(\'%s\');', serialize($a)));
exec('php '.__DIR__.'/test.php');

The output of the script is:

PHP Notice:  unserialize(): Error at offset 10 of 11 bytes in /Users/fabien/work/twig/test.php on line 1

The problem is that when a string contains two consecutive backslashes, it should be expanded to 4 to be correctly interpreted.

@sebastianbergmann sebastianbergmann merged commit a62bf11 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  PHPUnit/Framework/TestCase.php
2  PHPUnit/Framework/TestCase.php
@@ -720,7 +720,7 @@ public function run(PHPUnit_Framework_TestResult $result = NULL)
$strict = 'FALSE';
- $data = addcslashes(serialize($this->data), "'");
+ $data = addcslashes(serialize($this->data), "'\\");
$dependencyInput = addcslashes(
serialize($this->dependencyInput), "'"
Something went wrong with that request. Please try again.