I have developed a web application using Zend Framework version 2.8 few months ago and i use json serialization to retrieve data from my database.
So heres the problem : I have just open again the project few days agos and i have noticed that the json serialization didn't work anymore in some cases.
For example, if i do some basic json serialization like that it works great :
$test = array();
array_push($test,["test" => 1]);
array_push($test,["test" => 2]);
array_push($test,["test" => 3]);
array_push($test,["test" => 4]);
array_push($test,["test" => 5]);
return $this->getResponse()->setContent(Json::encode($test));
//[{"test":1},{"test":2},{"test":3},{"test":4},{"test":5}] works!
But when i serialize to json with more datas from my database, nothing is displayed, like for example with this request :
foreach ($results as $activite) {
array_push($activitesTab,$activite);
}
var_dump($activitesTab) // $activitesTab is an array of the records of my db and i'm sure that it's not empty
return $this->getResponse()->setContent(Json::encode($activitesTab));
I don't understand why nothing is displayed, size limit maybe ? But i don't think that is the problem because i want to serialize "just" 100 records from the db.
If someone got an idea, it will be great for me to understand why i have this problem.
Thanks in advance