diff options
Diffstat (limited to 'phpBB/includes/functions.php')
-rw-r--r-- | phpBB/includes/functions.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 418e8dc51d..8e8bd56af6 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -48,11 +48,16 @@ function set_var(&$result, $var, $type, $multibyte = false) * Default is false, causing all bytes outside the ASCII range (0-127) to be replaced with question marks * @param bool $cookie This param is mapped to phpbb_request_interface::COOKIE as the last param for * phpbb_request_interface::variable for backwards compatability reasons. +* @param phpbb_request_interface|null|false If an instance of phpbb_request_interface is given the instance is stored in +* a static variable and used for all further calls where this parameters is null. Until +* the function is called with an instance it automatically creates a new phpbb_request +* instance on every call. By passing false this per-call instantiation can be restored +* after having passed in a phpbb_request_interface instance. * * @return mixed The value of $_REQUEST[$var_name] run through {@link set_var set_var} to ensure that the type is the * the same as that of $default. If the variable is not set $default is returned. */ -function request_var($var_name, $default, $multibyte = false, $cookie = false, phpbb_request_interface $request = null) +function request_var($var_name, $default, $multibyte = false, $cookie = false, $request = null) { // This is all just an ugly hack to add "Dependency Injection" to a function // the only real code is the function call which maps this function to a method. @@ -67,6 +72,15 @@ function request_var($var_name, $default, $multibyte = false, $cookie = false, p return; } } + else if ($request === false) + { + $static_request = null; + + if (empty($var_name)) + { + return; + } + } $tmp_request = $static_request; @@ -3253,7 +3267,7 @@ function get_preg_expression($mode) * Depends on whether installed PHP version supports unicode properties * * @param string $word word template to be replaced -* @param bool $use_unicode whether or not to take advantage of PCRE supporting unicode +* @param bool $use_unicode whether or not to take advantage of PCRE supporting unicode * * @return string $preg_expr regex to use with word censor */ |