From a79875c1eb124c085231429efca75cb435caf8d9 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Mon, 16 Apr 2012 16:42:32 -0400 Subject: [PATCH] The idn_to_ascii() function is only supported by PHP version 5.3 and up. --- core/util.inc.php | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/core/util.inc.php b/core/util.inc.php index 6ad2656f..2cad2224 100644 --- a/core/util.inc.php +++ b/core/util.inc.php @@ -35,9 +35,15 @@ function int_escape($input) { */ function url_escape($input) { /* The function idn_to_ascii is used to support Unicode domains / URLs as well. - See here for more: http://php.net/manual/en/function.filter-var.php */ - return filter_var(idn_to_ascii($input), FILTER_SANITIZE_URL); - + See here for more: http://php.net/manual/en/function.filter-var.php + However, it is only supported by PHP version 5.3 and up + */ + if (function_exists('idn_to_ascii')) { + return filter_var(idn_to_ascii($input), FILTER_SANITIZE_URL); + } else { + return filter_var($input, FILTER_SANITIZE_URL); + } + /*if(is_null($input)) { return ""; } @@ -71,8 +77,8 @@ function bool_escape($input) { Yay for Got'chas! http://php.net/manual/en/filter.filters.validate.php */ - if (is_bool($value)) { - return $value; + if (is_bool($input)) { + return $input; } else { $value = filter_var($input, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE); if (!is_null($value)) {