Successful Implementation... Almost

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
Summitt Dweller's picture

I spent quite a bit of time in the last week finishing up a new Drupal 6 site for the Iowa Geocachers Organization (http://new.IowaGeocachers.org) and most of the time was spent bridging our old phpBB2 forums into the site after an upgrade to phpBB3 and installation of the phpbbforums module.

Everything seems to be working well for MOST users. However, I have a handful of old forum users who, when they visit the new site or forums, get a perpetual string of FATAL errors mostly referring to re-declaration of various user functions like the one shown here:

Fatal error: Cannot redeclare user_get_id_name() (previously declared in .../public_html/phpBB3/includes/functions_user.php:27) in .../public_html/phpBB3/includes/functions_user.php on line 82

I believe in most (maybe all) cases the user is able to hit refresh and the error clears showing them the results they expected. However, the next operation throws the error again, they clear it, again it comes back, etc.

I've tried clearing the Drupal caches, clearing cookies and sessions in the forums, a number of things. Nothing appears to work for these few folks. In one instance the user didn't have much history in the forums and none in the web site so he had me delete his account and then he promptly recreated it... he has had no problems since then.

I don't understand the inner workings of sessions, cookies or account synchronization between the site and forums so I'm really scratching my head here wondering how to fix this problem or even determine what the root cause is. Anybody got a suggestion or two?

Thanks

Comments

Possible double include

newz2000's picture

It's possible that there is some rare occassion that causes phpBB3/includes/functions_user.php to get included twice. This would cause your functions to get declared multiple times which is not allowed in PHP.

A stop-gap solution is to change the affected file so that at the top it has somethign like this:

if(defined("PHPBB3_INCLUDES_FUNCTIONS_USER")) return;
define("PHPBB3_INCLUDES_FUNCTIONS_USER", 1);

What this does is check to see if a constant has been defined. If it does then it simply stops (i.e. returns) from the script and thereby preventing the functions from being redeclared. If the constant has not been defined then it means the script hasn't been included before and therefore proceeds by first defining the constant, then proceeding normally through the file.

You can define your constant whatever you want, but it must be unique. If you end up having to use this on multiple files make sure to use a different constant for each file.

However, normally your script will completely stop running if there's a fatal error. I think it's a bit odd that your users are seeing a long list of fatals. It makes me think something very fishy is happening. You might have to step through the code to see where this include is happening so that you can look to see what conditions would cause it to happen multiple times.

To make matters more challenging for you, it's helpful to know if the problem is being caused by the PHPBB upgrade or by the drupal module. Knowing the answer to this question helps you ask for assistance in the correct place.

--
Matthew Nuzum
newz2000 on freenode

Found a Way Around

Summitt Dweller's picture

Yeah, I understand how the DEFINEs work but really don't want to mess with them. There are at least two in play here, one of them implemented in a rather lengthy patch that the phpbbforum module supplies.

I did find at least one way around this so it's no longer the mission critical issue that it was.

Thanks for taking a look.

Mark

What was the fix, for future

aitala's picture

What was the fix, for future reference?

Eric

Summitt Dweller's picture

The patch supplied with the phpbbforums module makes several changes to phpBB3's ./includes/functions_user.php code. The last change in the patch removed function "remove_newly_registered( )" from that code and some of my users were in a state where that function still needed to be called.

I found that if I, as the site admin, manually reset their password on the web site the changes would propagate to the forums as expected, but along the way the system would still crash when the missing function was called. I'm really not sure why some user records triggered this condition while most others did not. Anyway, I restored this function back into functions_users.php, reset a few user passwords and all is well (so far).

I don't believe the function does any harm in its restored state so I'm leaving it in the code. It looks like other parts of the patch make the newly registered entries obsolete (probably the reason why the patch also removed this function).

Users affected by this reported that after my password reset they were able to log in successfully and make password resets of their own.

Mark

Nice site!

cattlecall's picture

Mark,

Your site looks great! Any chance you'll give us a presentation on how you built your site in a future iDug meeting?

Sure

Summitt Dweller's picture

Yeah, if/when iDug finds a new home (any news yet?) I'd be happy to introduce the group to this site (always looking to recruit new IGO members too!).

The best part about this site is that it's almost all "right out of the box". I didn't have to code many additions/changes to it apart from some stuff to handle the batch API for processing of geocache data in bulk.

I'm really pleased with two parts of the site in particular... the maps (Mapstraction is an awesome module!) and using "attachement" views.

Honestly, I would love to have the group look it over and give me suggestions for improvements as it is still in its infancy.

Mark