Skip to content

Commit 7c82ff4

Browse files
committed
make double encoding the default like htmlspecialchars
1 parent 5923416 commit 7c82ff4

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

src/Illuminate/Support/helpers.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ function dd(...$args)
571571
* @param bool $doubleEncode
572572
* @return string
573573
*/
574-
function e($value, $doubleEncode = false)
574+
function e($value, $doubleEncode = true)
575575
{
576576
if ($value instanceof Htmlable) {
577577
return $value->toHtml();

src/Illuminate/View/Compilers/BladeCompiler.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,12 +480,22 @@ public function setEchoFormat($format)
480480
}
481481

482482
/**
483-
* Set the echo format to double encode entities.
483+
* Set the "echo" format to double encode entities.
484484
*
485485
* @return void
486486
*/
487-
public function doubleEncode()
487+
public function withDoubleEncoding()
488488
{
489489
$this->setEchoFormat('e(%s, true)');
490490
}
491+
492+
/**
493+
* Set the "echo" format to not double encode entities.
494+
*
495+
* @return void
496+
*/
497+
public function withoutDoubleEncoding()
498+
{
499+
$this->setEchoFormat('e(%s, false)');
500+
}
491501
}

0 commit comments

Comments
 (0)