Monday, March 20, 2017

Array to string conversion error using php v7.0.13

I have the following code in my laravel controller file.

$j_decode->$data['_kfdTourDate']->available = ($j_decode->$data['_kfdTourDate']->available+$totalincrement); 

and I am getting the following error.

ErrorException in BookingsController.php line 325: Array to string conversion in BookingsController.php line 325 at HandleExceptions->handleError('8', 'Array to string conversion', 'D:\XAMPP\htdocs\lara\app\Http\Controllers\BookingsController.php', '325', array('request' => object(Request), 'id' => '0', 'rules' => array(), 'validator' => object(Validator), 'data' => array('_kpnID' => '153290', '_kfnTourID' => '2', '_kfdTourDate' => '2017-03-16', 'nAdults' => '2', 'nChildren' => '1', 'nInfants' => '0', 'nBabies' => '2', 'nFOC' => '2', 'nPriceAdult' => '74.25', 'nPriceChild' => '49.5', 'nPriceInfant' => '0', 'nPriceBaby' => '0', 'nTotalPrice' => '148.5', 'tGuestName' => 'Yuhiko Nishioka', 'tGuestOrigin' => 'Unknown', 'tEnquirySourceWhat' => 'Unknown', 'tStatus' => 'Confirmed', '_kfnAgentID' => '0', '_kfnPersonID' => '0', '_kfnInvoiceID' => '0', 'nAgentCommissionPercent' => '0', 'nDiscount_percent' => '0', 'nDiscount_fixed' => '0', 'tNotes' => '4WD Tour package/Rezdy, applied discount', 'tInitials' => 'JD', 'CreatedOn' => '2017-01-21 15:08:00', 'ModifiedOn' => '2017-01-21 15:10:00', 'tTicketNumber' => 'Rezdy', '_kfnOrganisationID' => '0'), 'schedule' => object(Collection), 'j_decode' => object(stdClass), 'update_id_data' => object(stdClass), 'totalincrement' => '3')) in BookingsController.php line 325

Interesting part that it's working on the linux server when I upload it to my host. I was pulling my hair I thought it is not working. I have PHP Version 7.0.13 on localhost and PHP Version 5.6.30 on the server. It is very hard to understand how this line can cause an Array to string conversion error. Can you help me to figure this out I am not willing to downgrade my php version on localhost as I have other codes that php5 is not supporting. Thanks in advanced.



via hijacker83

Advertisement