User Administration fails with PHP error

Found a bug? Tell us!!
Post Reply
bebr
Regular
Posts: 34
Joined: Thu Apr 26, 2007 2:47 am

User Administration fails with PHP error

Post by bebr »

Hello,
when I click in "Benutzerverwaltung" (user administration) :
serendipity_admin.php?serendipity[adminModule]=users

.. produces a php error:
Warning: Invalid argument supplied for foreach() in /var/www/apkk/us/include/admin/users.inc.php on line 188

As I understand from looking into the code there seems to be an inconsistency on the database. Background might be a recent failure when saving config settings that resulted in total misfunction of the site, everything worked (seemingly) fine after a Database-restart (postgresql-8.1.8 on Debian sarge).

A little irritating to me is the fact that there seem to be overlapping tables in the database, i.e. "serendipity_authors" as well as "sy_authors" - but maybe this is from an older installation attempt.

There are only three users so it would be fine for me to edit single records with phpPgAdmin if it helps.
How can I bring the DB back to consistency and make the user administration work?
chickens
Regular
Posts: 192
Joined: Wed Dec 06, 2006 12:15 am
Location: Vegas
Contact:

Re: User Administration fails with PHP error

Post by chickens »

bebr wrote:A little irritating to me is the fact that there seem to be overlapping tables in the database, i.e. "serendipity_authors" as well as "sy_authors" - but maybe this is from an older installation attempt.
Hey bebr,

I am going to answer this section as I do know the answer.

Serendipity only looks at one prefix that you are able to set in the configuration section of the admin panel. To see your current setting look at "Database table prefix" in that section. You should be able to remove everything not starting with that from the database.

I would suggest doing a full SQL backup prior to making any changes, because I am far from an expert when it comes to s9y.

As for your other issues you may try to install the latest version of s9y on top of your current installation. Most of the time when I have had this issue a reinstall has resolved the problem. If you have shell or SSH access to the server then its quite easy to reinstall. If you have to FTP to the server it takes quite a bit longer.
bebr
Regular
Posts: 34
Joined: Thu Apr 26, 2007 2:47 am

Post by bebr »

I have been searching before, and now again, to find the table prefix in the admin section - it's not there; running here is 1.1.2
But I have a good guess which of the two is the current one - and will remove the old (serendipity_*) ones after the backup.

Ok .. done .. and blog works.

But, as expected, this cleanup doesn't solve the issue, the error message remains. And I would like to solve the problem - the code worked before, so reinstalling SY with the old database won't help much.
chickens
Regular
Posts: 192
Joined: Wed Dec 06, 2006 12:15 am
Location: Vegas
Contact:

Post by chickens »

Depending on how many users your site has you may try to rename serendipity_config_local.inc.php and then go to the index of your site. This will cause the script to go into install mode where it will allow you to create your user again. If you create the new user with the same exact info as the original it should work just fine.

Again, I am not an expert with the script. I am just trying to troubleshoot the issue in the same way I would go about it on my own site.

As I was just about to post this I thought of something different. If you have an old SQL backup you could just grab the table serendipity_authors and replace the data in the current table. I would think this would resolve the issue.
bebr
Regular
Posts: 34
Joined: Thu Apr 26, 2007 2:47 am

Post by bebr »

Going into "install mode" is not so different from reinstalling and thus not an option.

sy_authors is fine, and deleting or updating it will increase the inconsistencies with references from other tables.
These references are IMHO the core of the challenge here, I assume some other table or index therein is faulty.

I'd love to hear proposals by one of the developers who have designed these relations.
bebr
Regular
Posts: 34
Joined: Thu Apr 26, 2007 2:47 am

Options logic

Post by bebr »

After some debugging I found the cause for the error is not a databases inconsistency i.e. corrupted content.

Actually I had changed (and did not consider it meaningful) the allowed actions for the usergroups: For 'CHIEF' these three options were de-selected:
  • adminUsersMaintainOthers
    adminUsersMaintainSame
    adminUsersGroups
This combination was obviously not considered in the coding and produced the error - de-selecting only 'adminUsersGroups' works fine.

Coding: I understand that not every combination of options is tested and commented before saving, this would require some kind of expert system. Having the possibility to change various options is also basically fine.
Only I would propose to change the code so that an error will not occur.
In this case this could be achieved by putting
$users = array()
before the if-clause in users.inc.php on line 179, so that the
foreach($users ..)
on line 188 would run zero times instead of throwing the error.
The same might be considered for other foreach-clauses involved in handling the usergroup-options.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Options logic

Post by garvinhicking »

Hi!

This better if-check has been inplemented into the 1.2 version tree already, I think. Thanks for digging into this!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply