FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » fud_sql_error_handler() not defined for FUDAPI calls
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
fud_sql_error_handler() not defined for FUDAPI calls [message #29584] Sun, 01 January 2006 20:56 Go to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
A call to external_get_user_by_auth($user, $pass) fails with the following error:

Fatal error: Call to undefined function:
fud_sql_error_handler() in .../data/include/theme/default/db.inc on line 73


Best regards.

Frank
Re: fud_sql_error_handler() not defined for FUDAPI calls [message #29585 is a reply to message #29584] Sun, 01 January 2006 21:09 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Looks like this function (fud_sql_error_handler) was moved from db.inc to core.inc in later releases.

I thought the solution would be simple, include core.inc in forum_login.php:

        if (!$GLOBALS['PATH_TO_FUD_FORUM_CORE_INC']) {
                require_once $GLOBALS['INCLUDE'] . 'core.inc';
        } else {
                require_once $GLOBALS['PATH_TO_FUD_FORUM_CORE_INC'];
        }


However, now it abends with -

Warning: error_log(sql_errors): failed to open stream: Permission denied in
...data/include/core.inc on line 182
UNABLE TO WRITE TO SQL LOG FILE
Re: fud_sql_error_handler() not defined for FUDAPI calls [message #29592 is a reply to message #29585] Mon, 02 January 2006 16:37 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Actually to work fudapi.inc.php requires you to load GLOBALS.php. This files loads core.inc for you automatically, so there should be no need for additional includes.

As far as permission error goes, you need to either unlock the forum, or chmod the error_log file 666.


FUDforum Core Developer
Re: fud_sql_error_handler() not defined for forum_login.php calls [message #29598 is a reply to message #29592] Mon, 02 January 2006 19:13 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Thank you for the reply and sorry for the confusing subject - s/FUDAPI/forum_login.php/g.

As you can see from the code below, forum_login.php loads the required settings from GLOBALS.php by itself:

        /* load forum config */
        $data = file_get_contents($GLOBALS['PATH_TO_FUD_FORUM_GLOBALS_PHP']);
        eval(str_replace('<?php', '', substr_replace($data, '', strpos($data, 'require'))));

        /* db.inc needs certain vars inside the global scope to work, so we export them */
        foreach (array('COOKIE_DOMAIN','COOKIE_NAME','COOKIE_TIMEOUT','COOKIE_PATH','FUD_OPT_1', 'FUD_OPT_3', 'FUD_OPT_2', 'DBHOST', 'DBHOST_USER', 'DBHOST_PASSWORD', 'DBHOST_DBNAME','DATA_DIR','INCLUDE') as $v) {
                $GLOBALS[$v] = $$v;
        }


Best regards.

Frank
Re: fud_sql_error_handler() not defined for forum_login.php calls [message #29601 is a reply to message #29598] Mon, 02 January 2006 22:26 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Fixed in CVS, here is the patch:
http://cvs.prohost.org/c/index.cgi/FUDforum/chngview?cn=7506


FUDforum Core Developer
Re: fud_sql_error_handler() not defined for forum_login.php calls [message #29606 is a reply to message #29601] Tue, 03 January 2006 05:38 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Thank you very much.

In addition to your patch, can you please also commit the following (db.inc also needs DBHOST_TBL_PREFIX):

--- forum_login.php.old 2006-01-02 23:34:48.000000000 -0600
+++ forum_login.php     2006-01-02 23:35:13.000000000 -0600
@@ -56,7 +56,7 @@
        eval(str_replace('<?php', '', substr_replace($data, '', strpos($data, 'require'))));

        /* db.inc needs certain vars inside the global scope to work, so we export them */
-       foreach (array('COOKIE_DOMAIN','COOKIE_NAME','COOKIE_TIMEOUT','COOKIE_PATH','FUD_OPT_1', 'FUD_OPT_3', 'FUD_OPT_2', 'DBHOST', 'DBHOST_USER', 'DBHOST_PASSWORD', 'DBHOST_DBNAME','DATA_DIR','INCLUDE') as $v) {
+       foreach (array('COOKIE_DOMAIN','COOKIE_NAME','COOKIE_TIMEOUT','COOKIE_PATH','FUD_OPT_1','FUD_OPT_3','FUD_OPT_2','DBHOST','DBHOST_USER','DBHOST_PASSWORD','DBHOST_DBNAME','DBHOST_TBL_PREFIX','DATA_DIR','INCLUDE') as $v) {
                $GLOBALS[$v] = $$v;
        }
Re: fud_sql_error_handler() not defined for forum_login.php calls [message #29607 is a reply to message #29606] Tue, 03 January 2006 14:19 Go to previous messageGo to next message
Ilia is currently offline  Ilia   Canada
Messages: 13241
Registered: January 2002
Karma: 0
Senior Member
Administrator
Core Developer
Added in CVS.

FUDforum Core Developer
Re: fud_sql_error_handler() not defined for forum_login.php calls [message #29609 is a reply to message #29607] Tue, 03 January 2006 14:45 Go to previous message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Thank you very much!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Enable forum always back to "No"
Next Topic: Slow to start a new thread, replies are fast
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Dec 03 19:34:27 GMT 2024

Total time taken to generate the page: 0.02510 seconds