aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2013-02-04 13:04:42 +0000
committerplegall <plg@piwigo.org>2013-02-04 13:04:42 +0000
commit4c4bf26b0cb44d1ba97fcfe2d86b0478713fb560 (patch)
treeee11bb721653f1700a36e64340e71c13e0b8a2ce
parentb267aea0e2821cd411530511bbb2698bc5e9b121 (diff)
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
-rw-r--r--include/functions_user.inc.php16
1 files 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)