0

I am getting a Fatal error when trying to go to a page

Fatal error: Can't use function return value in write context in /home/site/public_html/welcome/oc/classes/controller/panel/order.php on line 49

I looked into the code and found this

    //filter date
    if (!empty(Core::request('from_date')) AND (!empty(Core::request('to_date')))
    {
        //Getting the dates range
        $from_date = Core::request('from_date',strtotime('-1 month'));
        $to_date   = Core::request('to_date',time());
        $orders = $orders->where('pay_date','between',array($from_date,$to_date));
    }

can you tell me if there is something wrong with this code? thanks

When i remove the page the page works so i think it have something to do with the code or maybe it can't get the information from the database

  • possible duplicate of [Can't use method return value in write context](http://stackoverflow.com/questions/1075534/cant-use-method-return-value-in-write-context) – Marcin Orlowski Jan 29 '15 at 08:29
  • Can you number the line in your code sample? Can you also supply additional data, e.g. the params posted to this controller? – Daniel Le Jan 29 '15 at 08:29
  • You cannot do this in php <5.5 : `!empty(Core::request('from_date'))`. `empty` only works on variables. – Bart Haalstra Jan 29 '15 at 08:29
  • the code is here https://github.com/open-classifieds/open-eshop/blob/master/oc/classes/controller/panel/order.php#L49 – user3606549 Jan 29 '15 at 08:33

1 Answers1

2

It is because Core::request() has return statement and you cant you it in write context. Try with -

$fromDate = Core::request('from_date');
$toDate   = Core::request('to_date');
if (!empty($fromDate) AND (!empty($toDate))
Sougata Bose
  • 31,517
  • 8
  • 49
  • 87