I apologize in advance for what should be a pretty simple issue. I am very new to fuel. I recently acquired an existing site created in fuel 1.0. I have been tasked with moving this site from its existing server to a new server. The issue I am facing now is when I try to load the page I get the call to a member function error. The error is coming from the index.php view.
I know I am missing something, but I just can't seem to see what it is. I also know the site needs updated to current fuel release, but my client wants to get the site transferred and running before we begin that phase.
Any help you could give would be greatly appreciated.
You will get this error when you call a method on a variable that is not an object.
On which line of the view exactly do you get this error? If $contractor is not an object, the first line in the view referencing this variable would already trigger a notice error, unless error reporting is disabled (which is a bad thing if you're developing or debugging).
Your first port of call would be to look into the controller that uses this view, check which variable is passed as the view variable "contractor", and var_dump() it so see what it contains. And from there track back to see why it doesn't contain the expected object.
My assumption is because of a database look-up that doesn't give a result, and the result is not checked.
I get the error on "<?=$contractor->get_public_name();?>".
What I don't understand is, this site currently works on the old server. It didn't fail until I copied the code over. As of right now, the only thing I have changed is the config files to point to the new servers database. Another thing I have noticed is if I try to go to a different page, such as /login the code works but the css is not there.
Fact remains, the error is caused by $contractor not being an object. It's difficult to judge why that is the case. Perhaps the databases are not identical?
What OS and webserver is running on the old server? And which PHP version? And how about the new server? The css error smells like a rewriting issue...
Both servers are running linux, new is ubuntu server 14.04 the other is redhat. Both are running the same version of php.
I checked my log file and noticed that I am getting this same error on another call as well. Not sure what has changed to make these no longer objects but I am getting close to figuring it out.
I fixed the css issue. The project was using a package called casset. This package was trying to write to a cache directory in the assests directory. This did not exist on the new server. The directory was in the gitignore so I did not have it when I moved everything over.
I'm afraid you will have to start debugging to figure out why the variable passed from the controller to the view is not an object.
The error should give you a backtrace so it's easy to find which controller it is. Assuming it is programmed a bit decent, debugging should be less than 10 minutes work...
The key phrase is "programmed a bit decent". I do not believe this one was. It doesn't seem to follow what I have read in the docs. The backtrace points to corepath/bootstrap.php. So I will look there.
I believe I have found the problem. For some reason, the if statements in the view are being commented out when the code is ran on the server. No idea why, never seen this before.