I am using a fresh install of FuelPHP 1.7.3 and i'm getting the following error when trying to call a method of a custom class:
Exception [ Error ]:
File "APPPATH/classes/testclass.php" does not contain class "Testclass"
COREPATH/classes/autoloader.php @ line 395
The contents of APPPATH/classes/testclass.php :
<?php
class Testclass {
function __construct() {
}
public static function test() {
return 'HELLO';
}
public static function _init() {
}
}
and in the APPPATH/bootstrap.php file i have:
....
// Initialize the framework with the config file.
\Fuel::init('config.php');
echo Testclass::test();
Removing the __construct and _init methods from testclass.php makes no difference.
APPPATH is also pointing to the right path on the filesystem too.
Not sure why Fuel can't find the class?
The user and group the file is owned by is the same as all other PHP files on all other sites on the server so i don't think it's that, i've checked the permissions on the classes/testclass.php file and the owner and group have read and write access, just to make sure i chmod 777 the file so all users have read / write access, makes no difference though :(
if i var_dump the code above class_exists does return false however i am var_dump'ing it before the echo Testclass::test(); line. I added the following line of code above "echo Testclass::test();" to make sure the file was being included:
include('classes/testclass.php');
echo Testclass::test();
and i get the following error:
ErrorException [ Fatal Error ]:
Cannot redeclare class Testclass
APPPATH/classes/testclass.php @ line 3
Fuel must be including the file at some point to get this error but the autoloader isn't picking up on the class after it's included perhaps?
It looks like you're new here. If you want to get involved, click one of these buttons!