bug #30102 [Workflow] Graphviz dumper escape not always a string (Korbeil)

This PR was merged into the 4.2 branch.

Discussion
----------

[Workflow] Graphviz dumper escape not always a string

| Q             | A
| ------------- | ---
| Branch?       | 4.1
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | N/A
| License       | MIT
| Doc PR        | N/A

The `escape` function takes a string as parameter but it can be a `bool` (see `findTransitions` method in same class). In this PR I allow any type in `escape` and does escaping only for `string`.

Commits
-------

1b17192b0a escape function does not always take a string
This commit is contained in:
Grégoire Pineau 2019-02-08 11:00:05 +01:00
commit bac2c99733

View File

@ -204,9 +204,9 @@ class GraphvizDumper implements DumperInterface
/**
* @internal
*/
protected function escape(string $string): string
protected function escape($value): string
{
return addslashes($string);
return \is_bool($value) ? ($value ? '1' : '0') : \addslashes($value);
}
private function addAttributes(array $attributes): string