diff options
author | Cash Costello <cash.costello@gmail.com> | 2012-06-23 09:16:22 -0400 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2012-06-23 09:16:22 -0400 |
commit | 8fd511bcd35646c64658f63cfd35f4b0fb3541a8 (patch) | |
tree | 7a736385f238d1bf2a5447c40c996e5fd3cb19a6 | |
parent | ffd992ae30c58acd60ccd1f536a5000982fc4745 (diff) | |
download | elgg-8fd511bcd35646c64658f63cfd35f4b0fb3541a8.tar.gz elgg-8fd511bcd35646c64658f63cfd35f4b0fb3541a8.tar.bz2 |
Fixes #4168 returning default value from elgg_extract if non-array passed - not removing type hint since we downgraded it from an error to a warning
-rw-r--r-- | engine/lib/elgglib.php | 6 | ||||
-rw-r--r-- | engine/lib/views.php | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 65666954c..9aad2a5bd 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -1578,7 +1578,11 @@ function elgg_http_url_is_identical($url1, $url2, $ignore_params = array('offset * @return void * @since 1.8.0 */ -function elgg_extract($key, array $array, $default = NULL, $strict = true) { +function elgg_extract($key, array $array, $default = null, $strict = true) { + if (!is_array($array)) { + return $default; + } + if ($strict) { return (isset($array[$key])) ? $array[$key] : $default; } else { diff --git a/engine/lib/views.php b/engine/lib/views.php index c98ad4e78..25acbf2b2 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1224,12 +1224,12 @@ function elgg_view_image_block($image, $body, $vars = array()) { * @param string $type The type of module (main, info, popup, aside, etc.) * @param string $title A title to put in the header * @param string $body Content of the module - * @param string $vars Additional parameters for the module + * @param array $vars Additional parameters for the module * * @return string * @since 1.8.0 */ -function elgg_view_module($type, $title, $body, $vars = array()) { +function elgg_view_module($type, $title, $body, array $vars = array()) { $vars['class'] = elgg_extract('class', $vars, '') . " elgg-module-$type"; $vars['title'] = $title; |