I’m using yii framework 1.1, hosting with nginx.
Following this guide, i have posting data normally via a html form (application/x-www-form-urlencoded). On controller of create action, i can get the posted data and assign it to my model (massive assignment):
$model->attributes=$_POST['Course'];
However, on another action, i got data from json (application/json), i cannot assign json data to my model.
$jsonContent = file_get_contents('php://input');
$model->attributes=json_decode($jsonContent);
I’m sure that the data from $_POST[‘Course’] and the json from $jsonContent are the same.
I have checked the rules of model and all field are marked as save.
I’m maintaining an old system and i’m not sure if any configuration of yii framework may cause this issue. If you suspect any Yii configuration, let me know and i will check.
Thanks