Home arrow Forum Bug: Cannot redeclare db_query
  Welcome, Guest. Please login or register.
Did you miss your activation email?
January 09, 2009, 05:48:08 AM
Home New Posts Search Calendar


Login with username, password and session length
+  Joomla Forum
|-+  Joomla Hacks
| |-+  Joomla-SMF Forum Support
| | |-+  Joomla-SMF 1.1.x (Moderators: -Wolverine, kai920)
| | | |-+  Bug: Cannot redeclare db_query
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Bug: Cannot redeclare db_query  (Read 4468 times)
dvance
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 3


View Profile
Bug: Cannot redeclare db_query
« on: March 08, 2006, 03:51:43 PM »

After clean install and config, a Joomla login attempt consistently produces the error below.  I am not using CB.  The error occurs with BOTH Joomla and SMF registration module selected in the config, during BOTH login and logout.  Interestingly, although both login and logout produce the error, the login actually is successful, but the logout is not:

Fatal error: Cannot redeclare db_query() (previously declared in C:\Program Files\xampp\htdocs\r2\forum\Sources\Subs.php:237) in c:\Program Files\xampp\htdocs\r2\forum\Sources\Subs.php on line 237

From URL: http://localhost/r2/index.php?option=com_smf&action=login2&hash_passwrd=0&user=dvance&passwrd=snip&cookielength=15

My environment:
  • Joomla 1.0.8
  • SMF 1.1RC2
  • Joomla-SMF 1.1RC2(w/patch1)
  • NO CommunityBuilder (or CB plugin, just the standard login...)
  • PHP 4.4.0
  • MySQL 4.1.14-nt
  • Apache 2.0.54
  • Occurs in both Firefox 1.5.0.1 and IE 6.0.2;SP2
  • Running on XP Media Center '05

Only other installed components are ExtCal, MosCE and JoomlaBoard 1.1.2

And yes, I've done several reinstalls, reconfigs, repatches, reloads, and even a reboot for good measure.

This bug was posted last month in the SMF 1.0.x forum, but I thought I'd post it here since I'm using SMF 1.1RC2(patch1), and it was never resolved in the previous release.

Logged
-Wolverine
Moderator
Joomla Guru
*****

Karma: +376/-34
Offline Offline

Posts: 3393


Lead Developer


View Profile WWW
Re: Bug: Cannot redeclare db_query
« Reply #1 on: March 08, 2006, 04:35:07 PM »

my guess is that for some reason if Subs.php has already been included and then it is included again your webserver calls foul... or php... or something doesn't like that.  It is obviously a configuration or the rest of us would have this issue.  I see that if a user isn't found in SMF this file could be required then included.  This happens in two separate functions and normally would occur on login or logout... at the end of login and in the middle of a logout scenario.  There might be a better way to do this, I will investigate.
Logged

Need help?  Check Here First!
Get the JSMF User Guide
SEARCH this forum.
dvance
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 3


View Profile
Re: Bug: Cannot redeclare db_query
« Reply #2 on: March 08, 2006, 05:44:36 PM »

By the way, the previous discussion of this bug was in the 1.0.x board at http://www.joomlahacks.com/smf/index.php/topic,947.0.html
Logged
-Wolverine
Moderator
Joomla Guru
*****

Karma: +376/-34
Offline Offline

Posts: 3393


Lead Developer


View Profile WWW
Re: Bug: Cannot redeclare db_query
« Reply #3 on: March 08, 2006, 09:26:25 PM »

ya, but when it was last reported a move from a localhost machine solved the problem.  The issue is that we need to fail if we can't include the file Subs.php so I am very hesitant to change the bit of code that is most likely causing this.  As a workaround you can modify the code in and around line 865(1205 in JSMF 1.1):
Code:
require_once($smf_path . '/Sources/Subs.php');


change this to

Code:
include_once($smf_path . '/Sources/Subs.php');
and you should not receive the fatal error anymore.
« Last Edit: April 04, 2006, 07:56:58 AM by -Wolverine » Logged

Need help?  Check Here First!
Get the JSMF User Guide
SEARCH this forum.
dvance
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 3


View Profile
Re: Bug: Cannot redeclare db_query
« Reply #4 on: March 09, 2006, 10:53:42 PM »

Thanks for the very quick reply!  The code change didn't have any effect; neither did commenting the line out altogether.  However, just for fun I commented out line 980, and everything works like a charm now:

Code:
        include_once( $mosConfig_absolute_path.'/administrator/components/com_smf/config.smf.php' );                                                           
        //include_once( $smf_path.'/Sources/Subs.php' ); COMMENTED OUT!

I don't know what to make of this yet.  I have to work on a few other things tonight.  But I wanted to thank you for your speedy assistance and let you know as soon as possible what I found...
Logged
-Wolverine
Moderator
Joomla Guru
*****

Karma: +376/-34
Offline Offline

Posts: 3393


Lead Developer


View Profile WWW
Re: Bug: Cannot redeclare db_query
« Reply #5 on: March 10, 2006, 07:46:49 AM »

WOW, thats not right at all.  The definition of include_once clearly states it will not fatal error. 

http://us2.php.net/manual/en/function.include-once.php

ahhh, but this line tells the story.  st$p$d windows:

Quote from: php.net include_once definition
Note:  Be aware, that the behaviour of include_once()  and require_once() may not be what you expect on a non case sensitive operating system (such as Windows).
Logged

Need help?  Check Here First!
Get the JSMF User Guide
SEARCH this forum.
Stuart Clark
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: Bug: Cannot redeclare db_query
« Reply #6 on: April 03, 2006, 04:02:30 PM »

Thanks for the very quick reply!  The code change didn't have any effect; neither did commenting the line out altogether.  However, just for fun I commented out line 980, and everything works like a charm now:

Code:
        include_once( $mosConfig_absolute_path.'/administrator/components/com_smf/config.smf.php' );                                                           
        //include_once( $smf_path.'/Sources/Subs.php' ); COMMENTED OUT!

I don't know what to make of this yet.  I have to work on a few other things tonight.  But I wanted to thank you for your speedy assistance and let you know as soon as possible what I found...
Which file is it we need to edit?
Logged
-Wolverine
Moderator
Joomla Guru
*****

Karma: +376/-34
Offline Offline

Posts: 3393


Lead Developer


View Profile WWW
Re: Bug: Cannot redeclare db_query
« Reply #7 on: April 03, 2006, 05:22:14 PM »

administrator/components/com_smf/functions.smf.php
Logged

Need help?  Check Here First!
Get the JSMF User Guide
SEARCH this forum.
Stuart Clark
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: Bug: Cannot redeclare db_query
« Reply #8 on: April 04, 2006, 04:50:11 AM »

Well...my copy of that file looks nothing like the one being talked about here (based on line numbers) and editing it to remove or change any references to including subs.php didn't fix the issue for me.

Right now, I'm going back to an earlier version of the bridge, which didn't contain this issue.
Logged
Stuart Clark
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 8


View Profile
Re: Bug: Cannot redeclare db_query
« Reply #9 on: April 04, 2006, 07:53:34 PM »

Right guys... I got mine working, but I did it by reverting to the RC2 (plus fixes) version of the bridge.

I didn't change ANYTHING else, so tell me... what code changed between RC2+fixes and 1.1.01 to cause this issue?
Logged
-Wolverine
Moderator
Joomla Guru
*****

Karma: +376/-34
Offline Offline

Posts: 3393


Lead Developer


View Profile WWW
Re: Bug: Cannot redeclare db_query
« Reply #10 on: April 04, 2006, 08:03:34 PM »

RC2+fixes?  Only comments and a few parameters were retrieved using a Joomla function versus regular retrieval, but nothing in regards to the bit of code that is failing for you.  And some people had this problem with RC2 so I am not sure what is going on for you though.
Logged

Need help?  Check Here First!
Get the JSMF User Guide
SEARCH this forum.
Angelos
QA / Testers
Joomla Newbie
*****

Karma: +0/-0
Offline Offline

Posts: 39



View Profile WWW
Re: Bug: Cannot redeclare db_query
« Reply #11 on: April 06, 2006, 06:55:58 AM »

But don't forget that older versions have other bugs...
Otherwise newer versions wouldn't exist...

I have the same problem after changing the smf owner from my user to wwwrun.
Maybe it is connected with this change?

I use joomla 1.07
SMF 1.1RC2 (+double post merge mod..)
jsmf 1.101
cb 1.0 RC2
jsmf cb plugin (latest)
« Last Edit: April 07, 2006, 01:45:04 AM by Angelos » Logged

Joomla! 1.0.12
SMF 1.1 RC3-JSMF 2.0
CB 1.0.2Stable

Corfu... the place to be
Pages: [1] Go Up Print 
« previous next »
Jump to:  



Login with username, password and session length

Powered by MySQL Powered by PHP Joomla Forum | Powered by SMF 1.1 RC1.
© 2001-2005, Lewis Media. All Rights Reserved.
Joomla Bridge by JoomlaHacks.com
Valid XHTML 1.0! Valid CSS!

Joomla Hacks is a Joomla Components, Joomla Modules, Joomla Templates, & Joomla Mambots resource portal. None of the text or images in this public website may be copied without the expressed written consent of the authors. Copyright 2005 by JoomlaHacks.com. Powered by Joomla. All rights reserved.
Terms of Use
Joomla Hacks



Joomla Hacks
German Lang French Lang Italian Lang Spanish Lang Japanese Lang Chinese Lang
Search Contact About Advertise Blogs Topsites Submit News Register Login