I'm facing a horrible problem in Linux server. I don't understand what to do now.
My problem is that in Linux server my script runs properly without any error but when I use an object to JSON encode it returns false.
Please any one help. Thanks in advance.
public function ajaxDataSearch() {
$this->loadModel('ViewDocketHistorys');
$this->render(false);
$this->viewBuilder()->layout('false');
if ($this->request->is(['post'])) {
$DocketNo = $this->request->data['DocketNo'];
$SearchData = $this->ViewDocketHistorys->find()
->where(['DocketNo' => $DocketNo])
->last();
$Jsondate = json_encode($SearchData);
echo $Jsondate;
}
}
When I debug query data
debug($SearchData); exit;
output:
object(App\Model\Entity\ViewDocketHistory) {
'MasterID' => (int) 311,
'DocketNo' => 'fhfghfghf',
'[new]' => false,
'[accessible]' => [
'*' => true
],
'[dirty]' => [],
'[original]' => [],
'[virtual]' => [],
'[errors]' => [],
'[invalid]' => [],
'[repository]' => 'ViewDocketHistorys'}
When I debug JSON encode
debug($Jsondate); exit;
Output:
false