Changeset 20545


Ignore:
Timestamp:
Feb 4, 2013, 2:04:42 PM (11 years ago)
Author:
plg
Message:

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)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_user.inc.php

    r20282 r20545  
    809809  if (!isset($cache['default_user']))
    810810  {
    811     $query = 'SELECT * FROM '.USER_INFOS_TABLE.
    812             ' WHERE user_id = '.$conf['default_user_id'].';';
     811    $query = '
     812SELECT *
     813  FROM '.USER_INFOS_TABLE.'
     814  WHERE user_id = '.$conf['default_user_id'].'
     815;';
    813816
    814817    $result = pwg_query($query);
    815     $cache['default_user'] = pwg_db_fetch_assoc($result);
    816 
    817     if ($cache['default_user'] !== false)
    818     {
     818
     819    if (pwg_db_num_rows($result) > 0)
     820    {
     821      $cache['default_user'] = pwg_db_fetch_assoc($result);
     822     
    819823      unset($cache['default_user']['user_id']);
    820824      unset($cache['default_user']['status']);
    821825      unset($cache['default_user']['registration_date']);
     826    }
     827    else
     828    {
     829      $cache['default_user'] = false;
    822830    }
    823831  }
Note: See TracChangeset for help on using the changeset viewer.