Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6aa190b

Browse filesBrowse files
committed
[OutputEscaper] added SafeDecoratorInterface
1 parent 7650dd7 commit 6aa190b
Copy full SHA for 6aa190b

File tree

Expand file treeCollapse file tree

3 files changed

+28
-7
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+28
-7
lines changed

‎src/Symfony/Component/OutputEscaper/Escaper.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/OutputEscaper/Escaper.php
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,18 @@ static public function escape($escaper, $value)
118118
return $copy;
119119
}
120120

121-
if (self::isClassMarkedAsSafe(get_class($value))) {
122-
// the class or one of its children is marked as safe
123-
// return the unescaped object
124-
return $value;
125-
}
126-
127121
if ($value instanceof SafeDecorator) {
128122
// do not escape objects marked as safe
129123
// return the original object
130124
return $value->getValue();
131125
}
132126

127+
if (self::isClassMarkedAsSafe(get_class($value)) || $value instanceof SafeDecoratorInterface) {
128+
// the class or one of its children is marked as safe
129+
// return the unescaped object
130+
return $value;
131+
}
132+
133133
if ($value instanceof \Traversable) {
134134
return new IteratorDecorator($escaper, $value);
135135
}

‎src/Symfony/Component/OutputEscaper/SafeDecorator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/OutputEscaper/SafeDecorator.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*
1717
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
1818
*/
19-
class SafeDecorator extends \ArrayIterator
19+
class SafeDecorator extends \ArrayIterator implements SafeDecoratorInterface
2020
{
2121
protected $value;
2222

+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Symfony\Component\OutputEscaper;
4+
5+
/*
6+
* This file is part of the Symfony package.
7+
*
8+
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
9+
*
10+
* For the full copyright and license information, please view the LICENSE
11+
* file that was distributed with this source code.
12+
*/
13+
14+
/**
15+
* Marks a class as being safe for output.
16+
*
17+
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
18+
*/
19+
interface SafeDecoratorInterface
20+
{
21+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.