From 1b7d684d07847367b7f46c7f7b6eb85be9c20cf2 Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Wed, 4 Jan 2017 14:35:52 -0500 Subject: [PATCH] Remove $a = array($a) which is miscompiled by Zend OpCache. Fixes #108. Signed-off-by: Edward Z. Yang --- library/HTMLPurifier/Strategy/MakeWellFormed.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/HTMLPurifier/Strategy/MakeWellFormed.php b/library/HTMLPurifier/Strategy/MakeWellFormed.php index e389e001..f027d138 100644 --- a/library/HTMLPurifier/Strategy/MakeWellFormed.php +++ b/library/HTMLPurifier/Strategy/MakeWellFormed.php @@ -534,12 +534,17 @@ class HTMLPurifier_Strategy_MakeWellFormed extends HTMLPurifier_Strategy */ protected function processToken($token, $injector = -1) { + // Zend OpCache miscompiles $token = array($token), so + // avoid this pattern. See: https://github.com/ezyang/htmlpurifier/issues/108 + // normalize forms of token if (is_object($token)) { - $token = array(1, $token); + $tmp = $token; + $token = array(1, $tmp); } if (is_int($token)) { - $token = array($token); + $tmp = $token; + $token = array($tmp); } if ($token === false) { $token = array(1); -- 2.11.4.GIT