Hi All,
Need you help to find out reason of error.
I am getting following error in API server developed in yii2
[error][yii\base\InvalidParamException]
yii\base\InvalidParamException: The maximum stack depth has been
exceeded. in /home/deployer/api/production/shared/vendor/yiisoft/yii2/helpers/BaseJson.php:123
This error comes randomly and as soon as I restart php-fpm process, error is vanished.
below is the server details
OS - CentOS release 6.8 (Final)
php - PHP 7.0.14 (cli) (built: Dec 10 2016 11:58:43) ( NTS )
Copyright © 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright © 1998-2016 Zend Technologies
with Zend OPcache v7.0.14, Copyright (c) 1999-2016, by Zend Technologies
Below is the section from config -
'response' => [
'class' => \common\components\Response::className(),
'format' => yii\web\Response::FORMAT_JSON,
'charset' => 'UTF-8',
'on beforeSend' => function ($event) {
$response = $event->sender;
if ($response->isOk()) {
$response->data = [
'status' => true,
'statusCode' => $response->getStatusCode(),
'statusText' => $response->statusText,
'data' => $response->data,
];
} else {
$response->data = [
'status' => false,
'statusCode' => $response->getStatusCode(),
'statusText' => $response->statusText,
'error' => $response->data
];
}
},
],
Any pointer to the solution will help.