summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Gass2024-06-10 15:23:42 +0200
committerNathan Gass2024-06-10 15:23:42 +0200
commit5a51732fc8d845d4c0e308b6340d9f4e20aa6ff4 (patch)
tree2f4aca07c47fcc4270faa18b625f4e30791308c8
parent25a946b8c2bf6638b7adfe2afa387fa26cb97e71 (diff)
downloaditools-5a51732fc8d845d4c0e308b6340d9f4e20aa6ff4.tar.gz
itools-5a51732fc8d845d4c0e308b6340d9f4e20aa6ff4.tar.bz2
itools-5a51732fc8d845d4c0e308b6340d9f4e20aa6ff4.zip
handle empty replacements array in it::replace
-rw-r--r--it.class2
1 files changed, 1 insertions, 1 deletions
diff --git a/it.class b/it.class
index 12c4176..e4e7385 100644
--- a/it.class
+++ b/it.class
@@ -547,7 +547,7 @@ static function replace($replacements, $string, $p = array())
foreach ($replacements as $pattern => $dummy)
$patterns[] = !preg_match('/\\\\[wb]|[!\x80-\xff]|\[\[:/i', $pattern) && !$p ? "!$pattern!i$encoding" : it::convertregex($pattern, $p);
- $result = preg_replace($patterns, $replacements, $string, isset($p['limit']) ? $p['limit'] : -1);
+ $result = preg_replace((array)$patterns, $replacements, $string, isset($p['limit']) ? $p['limit'] : -1);
if ($result === null && preg_last_error() == PREG_BAD_UTF8_ERROR)
it::error("Invalid utf-8 in it::replace haystack: " . substr($string, 0, 500)); # UTF8SAFE