]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4168 returning default value from elgg_extract if non-array passed - not remov...
authorCash Costello <cash.costello@gmail.com>
Sat, 23 Jun 2012 13:16:22 +0000 (09:16 -0400)
committerCash Costello <cash.costello@gmail.com>
Sat, 23 Jun 2012 13:16:22 +0000 (09:16 -0400)
engine/lib/elgglib.php
engine/lib/views.php

index 65666954cf8618ea3bd117c31d0ba1df6f424979..9aad2a5bd011ac2575ce8a4c54ac9a5c097f550a 100644 (file)
@@ -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 {
index c98ad4e7856336930a3d9706a25894fa9e37ca09..25acbf2b253a762e5bb222c34eeb2c32d160fa66 100644 (file)
@@ -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;