webissues
webissues copied to clipboard
Warning issued for array key SCRIPT_FILENAME
PHP Warning: Undefined array key "SCRIPT_FILENAME" in /home/username/sitename/subdir/system/bootstrap.inc.php on line 141
I understand this is just a warning and i did try to post this on your forum but i was not able to register on your forum because i never got a verify email from the forum, so i am posting here.
First thanks for doing this script, i really like it... :)
This warning i believe is caused because server SCRIPT_FILENAME is not always populated on some servers, so it needs to be qualified first.
in bootstrap.inc.php you have the following code
public static function getScriptPath()
{
if ( defined( 'WI_SCRIPT_PATH' ) )
return WI_SCRIPT_PATH;
$path = $_SERVER[ 'SCRIPT_FILENAME' ];
$real = realpath( $path );
if ( $real )
$path = $real;
$path = str_replace( '\\', '/', $path );
return $path;
}
$path value needs to be wrapped inside an if statement to be sure that SCRIPT_FILENAME has a value. Im not sure what value (referrer) it should have or i would do the code for you and post it here. I just wanted to give you a heads up so you know this was causing a warning without the if statement. :)
I think this may work
public static function getScriptPath()
{
if ( defined( 'WI_SCRIPT_PATH' ) )
return WI_SCRIPT_PATH;
//dave mod
if(!empty($_SERVER[ 'SCRIPT_FILENAME' ]))
{
$path = $_SERVER[ 'SCRIPT_FILENAME' ];
}else{
$path = __FILE__;
}
//original code
//$path = $_SERVER[ 'SCRIPT_FILENAME' ];
//end mod
$real = realpath( $path );
if ( $real )
$path = $real;
$path = str_replace( '\\', '/', $path );
return $path;
}