Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
plegall committed Feb 4, 2013
1 parent b267aea commit 4c4bf26
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions include/functions_user.inc.php
Expand Up @@ -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)
Expand Down

0 comments on commit 4c4bf26

Please sign in to comment.