Warning: strpos(): Empty delimiter. in /home/joomlaha/public_html/components/com_smf/smf.php on line 14
Subs.php error
Home arrow Forum Subs.php error
  Welcome, Guest. Please login or register.
Did you miss your activation email?
September 05, 2008, 04:22:01 AM
Home New Posts Search Calendar


Login with username, password and session length
+  Joomla Forum
|-+  Joomla Hacks
| |-+  Joomla-SMF Forum Support
| | |-+  Joomla-SMF 2.0.x (Moderators: -Wolverine, kai920)
| | | |-+  Subs.php error
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Print
Author Topic: Subs.php error  (Read 990 times)
abstrakt
Joomla Newbie
*

Karma: +0/-0
Offline Offline

Posts: 7


View Profile
Subs.php error
« on: September 25, 2006, 11:11:01 PM »

Hello,

Thank you for a fantastic bridge component!

I'm using:

Joomla version is: 1.0.11
SMF version is: 1.1 RC3
Joomla-SMF version: 2.0 beta 3
CB 1.0.1

Windows XP
Apache/1.3.34
PHP/5.1.2

/// ok, Subs.php

There have been other posts about this error.

http://www.joomlahacks.com/component/option,com_smf/Itemid,94/topic,2301.msg11014#msg11014

The error is something along these lines: PHP Fatal error:  Cannot redeclare db_query() then a path to smf forum / Subs.php.

Code was suggeste in the other thread, but it was flawed. I revisited the code and came up with an answer. The following code:

Code:
         // @!start subs patch
            $included_files = get_included_files();
           
            $testStr = $jsmfConfig->smf_path .'/Sources/Subs.php';
            $winStr = str_replace('/','\\', $testStr);
           
            $found = false;
            foreach ($included_files as $filename) {
                if (strcasecmp($filename, $winStr) == 0) {
                    $found = true;
                }
            }
            if (!$found) {
                include_once($winStr);
            }
        // end subs patch

Much of the above code was written by Wolverine. The flaw lay in windows pathing delimiter. When the oringinal code checked the loaded files string array for the Path/Subs.php, it couldn't find it because the slashes in the path were in the wrong direction. The str_replace remedys this problem.

I already posted on the other thread my findings, but I've since come upon another subs.php error, this time during user registration. I've patched this one the same way. I only write this so perhaps when the time is right for the development team, they might permenantly fix this issue for us windows users.

Thanks,
A.
Logged
-Wolverine
Moderator
Joomla Guru
*****

Karma: +374/-34
Offline Offline

Posts: 3393


Lead Developer


View Profile WWW
Re: Subs.php error
« Reply #1 on: September 25, 2006, 11:24:23 PM »

Thanks abstrakt!  I don't know if I will roll a workaround like this into the base code since PHP is supposed to handle this correctly.  However, I will put it on the 2.1 roadmap for discussion and might roll it into that version.  Grin
Logged

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

Karma: +0/-0
Offline Offline

Posts: 7


View Profile
Re: Subs.php error
« Reply #2 on: September 26, 2006, 03:35:17 PM »

Indeed. Windows fails me again.  Wink

Thank you for your work on this bridge!
Logged
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