I am using Yii Framework and am unable to remove a value from a session. When I call the function using ajax, I get this error in console
Indirect modification of overloaded element of CHttpSession has no effect
Any suggestion will be helpful thanks in advance . Below is my code
public function actiondeleteproductajax() {
$session = Yii::app()->session;
$id = isset($_POST['id']) ? $_POST['id'] : "";
$key = array_search($id, $session['cart_items']);
if ($key !== false) {
unset($session['cart_items'][$key]);
echo 'success';
}
}
i want to remove index of array because value containt similar ids of products added more than one time