Page 1 of 1

Undefined function call when required_once is in a function

Posted: Mon Jul 21, 2008 6:04 pm
by dayoung

Code: Select all

<?php
require_once('core.php');
class Mantis {
  
  function mantis_login($f_username,$f_password){
 
    if ( BASIC_AUTH == config_get( 'login_method' ) ) {
        $f_username = $_SERVER['REMOTE_USER'];
        $f_password = $_SERVER['PHP_AUTH_PW'];
    }
...
That works just fine but if I do this

Code: Select all

<?php
 
class Mantis {
  
  function mantis_login($f_username,$f_password){
    require_once('core.php');
    if ( BASIC_AUTH == config_get( 'login_method' ) ) {
        $f_username = $_SERVER['REMOTE_USER'];
        $f_password = $_SERVER['PHP_AUTH_PW'];
    }
...
I receive this error
Warning: 100 in /opt/lampp/htdocs/mantis/core/config_api.php on line 158

Warning: implode() [function.implode]: Bad arguments. in /opt/lampp/htdocs/mantis/core/config_api.php on line 330

Warning: 100 in /opt/lampp/htdocs/mantis/core/config_api.php on line 158

Warning: 100 in /opt/lampp/htdocs/mantis/core/config_api.php on line 158

Warning: 100 in /opt/lampp/htdocs/mantis/core/config_api.php on line 158

Fatal error: Call to undefined function db_is_connected() in /opt/lampp/htdocs/mantis/core/authentication_api.php on line 587
I've searched but I can't seem to get this to work or why it happens

Re: Undefined function call when required_once is in a function

Posted: Mon Jul 21, 2008 6:26 pm
by Christopher
What is the code on the lines given in the warnings?

Re: Undefined function call when required_once is in a function

Posted: Mon Jul 21, 2008 6:32 pm
by dayoung

Code: Select all

trigger_error( ERROR_CONFIG_OPT_NOT_FOUND, WARNING );
but if you want to see the whole code you can download it here.
http://sourceforge.net/project/showfile ... _id=166159

I'm trying to have another php page log into Mantis(Bug Tracking System)

But if I declare the require_once outside the class it works just fine but if it is declared inside a function that is the resulting error.