Yii Framework Forum: Issue in json_encode - The maximum stack depth has been - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Issue in json_encode - The maximum stack depth has been Rate Topic: -----

#1 User is offline   neo_anderson 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 06-July 09

Posted 29 January 2017 - 03:46 AM

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 © 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.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users