is it a bug?

Fatal error: Uncaught Error: Cannot unset string offsets in


/data/www/linktour/api/application/modules/private/controllers/OrdersController.php:400
Stack trace:
#0 [internal function]: Modules\_Private\Controllers\OrdersController->getAction('91')
#1 [internal function]: Phalcon\Mvc\Micro\LazyLoader->__call('getAction', Array)
#2 /data/www/linktour/api/public/index.php(369): Phalcon\Mvc\Micro->handle()
#3 {main}
  thrown in /data/www/linktour/api/application/modules/private/controllers/OrdersController.php on line 400

The PHP Code IS:


      ........
        if($role == 'seller' || $role == 'full'){
            $order['total']     = $order['seller']['total'];
            $order['refund']    = $order['seller']['refund'];
            $order['revenue']   = $order['seller']['revenue'];

            unset($order['seller']);
        }

        if(false === $order['cancellation_fee'])    unset($order['cancellation_fee']);

        // here is the 400 line code
        unset($order['buyer_uid'], $order['buyer_username'], $order['seller']['email'], $order['seller']['callback'], $order['seller']['logo'], $order['seller']['wechat'], $order['buyer']['email'], $order['buyer']['callback'], $order['buyer']['logo'], $order['buyer']['wechat'], $order['rate'], $order['payment']);

        foreach($order['logs'] as &$log){
            $log['created'] = date("c", $log['created']);
            $log['status'] = $this->id2name($log['status']);
        }
        .........


1.4k

PHP 7.0.11 + Phalcon 3.0.1 + Centos 7.0 64bit + Nginx



67.7k

first time i see someone uses unset like tat what the hell..


$myNewArr = array(
    'created_at' => $order['whatever'],
    'status' => $order['whatever']
);

unset($order);

it does seems like one of your $order elements is not the correct type

Issue not related to phalcon.