diff options
author | Brion Vibber <brion@pobox.com> | 2010-10-07 12:32:10 -0700 |
---|---|---|
committer | Brion Vibber <brion@pobox.com> | 2010-10-07 12:32:10 -0700 |
commit | 5e0f3e7bd4e7035efdb8bc62cd61d4613e1ad6b1 (patch) | |
tree | dbaa8fc4989274698015f362c0a40d018302d1bf | |
parent | 458f93bddd45ad3f37e18565edef67ac02ed15c2 (diff) |
Workaround for regression in input validation due to more PCRE oddities. Recommend redoing common_validate_utf8() using something more reliable, perhaps. :P
-rw-r--r-- | lib/util.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/util.php b/lib/util.php index 35fcfdb09..c05fcf15a 100644 --- a/lib/util.php +++ b/lib/util.php @@ -919,7 +919,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); } /** |