starnzd starnzd - 3 months ago 8
PHP Question

Fatal error on production server, staging is OK

I fix a web application based on CodeIgniter framework. I stumbled upon with strange error when I established the app on production server.


Fatal error: Can't use method return value in write context in /path/to/app/application/controllers/user.php on line 77


On that line I have this function:

public function update_user_movement(){
if (empty($this->input->post())){ // Line 77
redirect('user/movement','location');
}
// other code
}


As I mentioned in title I don't receive any error on staging server. Why is that?

Edit: I don't agree that this question is duplicate, because in other question CodeIgniter is not mentioned, and I think this problem is connected to it.

Answer

Probably different server configurations (if you're sure the files are identical). To fix it, do something like this:

public function update_user_movement(){
        $post = $this->input->post();
        if (empty($post)){ // Line 77
            redirect('user/movement','location');
        }
        // other code
}
Comments