Tuesday, March 14, 2017

what is a circular reference?

In PHP I have the following error: ErrorException: var_export does not handle circular references. When I Googled it I found some stackoverflow posts but they didn't explain what it is!

This is the code that is causing this:

  $client = new Client(config('app.twilio_sid'), config('app.twilio_token'));
  $twilio_call = $client->calls($input['CallSid'])->fetch();
  $twilio_call = (array) $twilio_call;

  Log::debug("Twilio Call Debugging");
  Log::debug($twilio_call);

  $call->where('sid',$input['CallSid'])->update(['calls' => $twilio_call]);

It should be getting a Json object which I cast to an array so that I can insert it into the database later. The error is caused in the update.

Please tell me what a circular reference is, and what might cause the error.



via Arnold

Advertisement