aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/mb_wrapper.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-02-12 14:56:20 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-02-12 14:56:20 +0000
commita2c37d05458bc25168bbfc892604208ffc17384b (patch)
treee8b2360af1be307cc9259a733700e4c4e4fcf5dc /engine/lib/mb_wrapper.php
parentc8c1ed7b095be798f459cd75a18d0dc249068ca6 (diff)
downloadelgg-a2c37d05458bc25168bbfc892604208ffc17384b.tar.gz
elgg-a2c37d05458bc25168bbfc892604208ffc17384b.tar.bz2
Fixes #1512: Using a helper function for mb_parse_str() instead of wrapping it exactly.
git-svn-id: http://code.elgg.org/elgg/trunk@3934 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/mb_wrapper.php')
-rw-r--r--engine/lib/mb_wrapper.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/engine/lib/mb_wrapper.php b/engine/lib/mb_wrapper.php
index 8bd9ddb8b..9aa4aac4c 100644
--- a/engine/lib/mb_wrapper.php
+++ b/engine/lib/mb_wrapper.php
@@ -6,6 +6,24 @@ if (is_callable('mb_internal_encoding')) {
ini_set("mbstring.internal_encoding", 'UTF-8');
}
+/**
+ * Parses a string using mb_parse_str() if available.
+ * NOTE: This differs from parse_str() by returning the results
+ * instead of placing them in the local scope!
+ *
+ * @param str $str
+ * @return array
+ */
+function elgg_parse_str($str) {
+ if (is_callable('mb_parse_str')) {
+ mb_parse_str($str, $results);
+ } else {
+ parse_str($str, $results);
+ }
+
+ return $results;
+}
+
// map string functions to their mb_str_func alternatives
// and wrap them in elgg_str_fun()
@@ -13,7 +31,8 @@ if (is_callable('mb_internal_encoding')) {
// only will work with mb_* functions that take the same
// params in the same order as their non-mb safe counterparts.
$str_funcs = array(
- 'parse_str',
+ // can't wrap parse_str() because of its 2nd parameter.
+ //'parse_str',
'split',
'stristr',
'strlen',