summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/util.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/util.php b/lib/util.php
index df339d4b1..85d7c72f4 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -946,7 +946,12 @@ function common_shorten_links($text, $always = false)
function common_validate_utf8($str)
{
// preg_replace will return NULL on invalid UTF-8 input.
- return preg_replace('//u', '', $str);
+ //
+ // Note: empty regex //u also caused NULL return on some
+ // production machines, but none of our test machines.
+ //
+ // This should be replaced with a more reliable check.
+ return preg_replace('/\x00/u', '', $str);
}
/**