From a2d546e3c07bd0f3a812593e62c1d9d6dbb5d50e Mon Sep 17 00:00:00 2001 From: Neil Drumm Date: Thu, 7 Sep 2006 08:23:54 +0000 Subject: #82524 by Heine and AjK. Remove use of array_walk(), which was causing segfaults in this case. --- includes/common.inc | 36 +++++++++++++++--------------------- includes/install.inc | 36 +++++++++++++++--------------------- 2 files changed, 30 insertions(+), 42 deletions(-) (limited to 'includes') diff --git a/includes/common.inc b/includes/common.inc index ffe4b0574..21b19f9e5 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -633,31 +633,25 @@ function t($string, $args = 0) { } else { // Transform arguments before inserting them - array_walk($args, '_t'); + foreach($args as $key => $value) { + switch ($key[0]) { + // Escaped only + case '@': + $args[$key] = check_plain($value); + break; + // Escaped and placeholder + case '%': + default: + $args[$key] = theme('placeholder', $value); + break; + // Pass-through + case '!': + } + } return strtr($string, $args); } } -/** - * Helper function: apply the appropriate transformation to st() and t() - * placeholders. - */ -function _t(&$value, $key) { - switch ($key[0]) { - // Escaped only - case '@': - $value = check_plain($value); - return; - // Escaped and placeholder - case '%': - default: - $value = theme('placeholder', $value); - return; - // Pass-through - case '!': - } -} - /** * @defgroup validation Input validation * @{ diff --git a/includes/install.inc b/includes/install.inc index 7a4dfa24d..59d1903a5 100644 --- a/includes/install.inc +++ b/includes/install.inc @@ -579,30 +579,24 @@ function st($string, $args = array()) { require_once './includes/theme.inc'; $GLOBALS['theme'] = 'theme'; // Transform arguments before inserting them - array_walk($args, '_st'); - return strtr((!empty($locale_strings[$string]) ? $locale_strings[$string] : $string), $args); -} - -/** - * Helper function: apply the appropriate transformation to st() and t() placeholders. - */ -function _st(&$value, $key) { - switch ($key[0]) { - // Escaped only - case '@': - $value = check_plain($value); - return; - // Escaped and placeholder - case '%': - default: - $value = ''. check_plain($value) .''; - return; - // Pass-through - case '!': + foreach($args as $key => $value) { + switch ($key[0]) { + // Escaped only + case '@': + $args[$key] = check_plain($value); + break; + // Escaped and placeholder + case '%': + default: + $args[$key] = ''. check_plain($value) .''; + break; + // Pass-through + case '!': + } } + return strtr((!empty($locale_strings[$string]) ? $locale_strings[$string] : $string), $args); } - /** * Check a profile's requirements. * -- cgit v1.2.3