Skip to content

Commit

Permalink
bug #30102 [Workflow] Graphviz dumper escape not always a string (Kor…
Browse files Browse the repository at this point in the history
…beil)

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
-------

1b17192 escape function does not always take a string
  • Loading branch information
lyrixx committed Feb 8, 2019
2 parents 02adcc3 + 1b17192 commit bac2c99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Symfony/Component/Workflow/Dumper/GraphvizDumper.php
Expand Up @@ -204,9 +204,9 @@ protected function dotize($id)
/**
* @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
Expand Down

0 comments on commit bac2c99

Please sign in to comment.