From 026a9ba216eed8fe510501e76381d6fc8c16079d Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 4 Jun 2015 05:04:34 +0700 Subject: [PATCH 1/3] drop PHP 5.4 check --- src/Escaper.php | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/Escaper.php b/src/Escaper.php index b732c5e..87ef08f 100644 --- a/src/Escaper.php +++ b/src/Escaper.php @@ -41,13 +41,11 @@ class Escaper /** * Holds the value of the special flags passed as second parameter to - * htmlspecialchars(). We modify these for PHP 5.4 to take advantage - * of the new ENT_SUBSTITUTE flag for correctly dealing with invalid - * UTF-8 sequences. + * htmlspecialchars(). * * @var string */ - protected $htmlSpecialCharsFlags = ENT_QUOTES; + protected $htmlSpecialCharsFlags; /** * Static Matcher which escapes characters for HTML Attribute contexts @@ -89,8 +87,7 @@ class Escaper /** * Constructor: Single parameter allows setting of global encoding for use by - * the current object. If PHP 5.4 is detected, additional ENT_SUBSTITUTE flag - * is set for htmlspecialchars() calls. + * the current object. * * @param string $encoding * @throws Exception\InvalidArgumentException @@ -116,9 +113,8 @@ public function __construct($encoding = null) $this->encoding = $encoding; } - if (defined('ENT_SUBSTITUTE')) { - $this->htmlSpecialCharsFlags|= ENT_SUBSTITUTE; - } + // We take advantage of ENT_SUBSTITUTE flag to correctly deal with invalid UTF-8 sequences. + $this->htmlSpecialCharsFlags = ENT_QUOTES | ENT_SUBSTITUTE; // set matcher callbacks $this->htmlAttrMatcher = [$this, 'htmlAttrMatcher']; From 2014eaba734675f38fb8065662b62e98b3325bc5 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Thu, 4 Jun 2015 12:08:45 +0700 Subject: [PATCH 2/3] bump php version to 5.5 --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 40b4f24..2abc628 100644 --- a/composer.json +++ b/composer.json @@ -32,4 +32,4 @@ "fabpot/php-cs-fixer": "1.7.*", "phpunit/PHPUnit": "~4.0" } -} \ No newline at end of file +} From 88b2db87c3000c174753818e0cc48ddae16d4655 Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 16 Oct 2015 12:49:40 +0700 Subject: [PATCH 3/3] @var int for $htmlSpecialCharsFlags --- src/Escaper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Escaper.php b/src/Escaper.php index 87ef08f..258dbdf 100644 --- a/src/Escaper.php +++ b/src/Escaper.php @@ -43,7 +43,7 @@ class Escaper * Holds the value of the special flags passed as second parameter to * htmlspecialchars(). * - * @var string + * @var int */ protected $htmlSpecialCharsFlags;