]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Merge branch '0.9.x' into 1.0.x
[quix0rs-gnu-social.git] / lib / util.php
index df339d4b1e39e6058c84ea3d31becf2e1bb05210..85d7c72f453fb59b58ecd671bb975409b17b081d 100644 (file)
@@ -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);
 }
 
 /**