From 4c4bf26b0cb44d1ba97fcfe2d86b0478713fb560 Mon Sep 17 00:00:00 2001 From: plegall Date: Mon, 4 Feb 2013 13:04:42 +0000 Subject: feature 65: fetch_assoc behaves different with mysql and mysqli. When no row is returned, mysql returns bool:false, while mysqli returns null and it was breaking completely the installation process. I have faked the old mysql behavior with mysqli (just for get_default_user_infos function) git-svn-id: http://piwigo.org/svn/trunk@20545 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_user.inc.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php index b1f55ea2e..d6250c582 100644 --- a/include/functions_user.inc.php +++ b/include/functions_user.inc.php @@ -808,18 +808,26 @@ function get_default_user_info($convert_str = true) if (!isset($cache['default_user'])) { - $query = 'SELECT * FROM '.USER_INFOS_TABLE. - ' WHERE user_id = '.$conf['default_user_id'].';'; + $query = ' +SELECT * + FROM '.USER_INFOS_TABLE.' + WHERE user_id = '.$conf['default_user_id'].' +;'; $result = pwg_query($query); - $cache['default_user'] = pwg_db_fetch_assoc($result); - if ($cache['default_user'] !== false) + if (pwg_db_num_rows($result) > 0) { + $cache['default_user'] = pwg_db_fetch_assoc($result); + unset($cache['default_user']['user_id']); unset($cache['default_user']['status']); unset($cache['default_user']['registration_date']); } + else + { + $cache['default_user'] = false; + } } if (is_array($cache['default_user']) and $convert_str) -- cgit v1.2.3