From bb584627248cc95443ebda511fca51effea6d0af Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 7 Mar 2013 13:03:27 +0100 Subject: [ticket/11404] Use a default data row if $row is empty in clean_row() A statically defined $default_row will be used inside the phpbb_avatar_manager::clean_row() method if the $row passed to it is empty. PHPBB3-11404 --- phpBB/includes/avatar/manager.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'phpBB/includes/avatar/manager.php') diff --git a/phpBB/includes/avatar/manager.php b/phpBB/includes/avatar/manager.php index f126d69300..58d994c3c0 100644 --- a/phpBB/includes/avatar/manager.php +++ b/phpBB/includes/avatar/manager.php @@ -45,6 +45,17 @@ class phpbb_avatar_manager */ protected $container; + /** + * Default avatar data row + * @var array + */ + static protected $default_row = array( + 'avatar' => '', + 'avatar_type' => '', + 'avatar_width' => '', + 'avatar_height' => '', + ); + /** * Construct an avatar manager object * @@ -174,20 +185,15 @@ class phpbb_avatar_manager */ static public function clean_row($row) { - $keys = array_keys($row); - $values = array_values($row); - // Upon creation of a user/group $row might be empty - if (empty($keys)) + if (empty($row)) { - return array( - 'avatar' => '', - 'avatar_type' => '', - 'avatar_width' => '', - 'avatar_height' => '', - ); + return self::$default_row; } + $keys = array_keys($row); + $values = array_values($row); + $keys = array_map(array('phpbb_avatar_manager', 'strip_prefix'), $keys); return array_combine($keys, $values); -- cgit v1.2.1