Fatal error Cannot use object of type stdClass as array in Record.php

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • romulo
    Junior Member
    • Nov 2018
    • 9

    Fatal error Cannot use object of type stdClass as array in Record.php

    Hi

    After upgrade to 5.4.5 version in this week, i received this message when a create a new lead in form or API


    Fatal error</b>: Cannot use object of type stdClass as array in xxxxx/application/Espo/Services/Record.php on line517

    can you help me?

  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2
    Hello,
    can you attach body content?

    Comment


    • romulo
      romulo commented
      Editing a comment
      HI

      This a post json request in browser

      {
      "firstName": "Fulano",
      "lastName": "beltrano",
      "status": "New",
      "source": "",
      "industry": "",
      "assignedUserId": "1",
      "assignedUserName": "Admin",
      "salutationName": "Mr.",
      "phoneNumberData": [
      {
      "phoneNumber": "99999",
      "primary": true,
      "type": "Mobile"
      }
      ],
      "phoneNumber": "99999",
      "emailAddressData": [
      {
      "emailAddress": "fulano@gmail.com",
      "primary": true,
      "optOut": false,
      "invalid": false,
      "lower": "fulano@gmail.com"
      }
      ],
      "emailAddress": "fulano@gmail.com",
      "emailAddressIsOptedOut": false,
      "addressCity": "",
      "addressPostalCode": "",
      "addressStreet": "rs",
      "addressState": "",
      "addressCountry": "",
      "cursosName": null,
      "cursosId": null,
      "website": "",
      "description": "",
      "teamsIds": [],
      "teamsNames": {}
      }


      AND this array $data in record.php


      object(stdClass)#165 (24) {
      ["firstName"]=>
      string(3) "rew"
      ["lastName"]=>
      string(5) "werwe"
      ["status"]=>
      string(3) "New"
      ["source"]=>
      string(0) ""
      ["industry"]=>
      string(0) ""
      ["assignedUserId"]=>
      string(1) "1"
      ["assignedUserName"]=>
      string(5) "Admin"
      ["salutationName"]=>
      string(3) "Mr."
      ["phoneNumberData"]=>
      array(1) {
      [0]=>
      object(stdClass)#166 (3) {
      ["phoneNumber"]=>
      string(6) "543254"
      ["primary"]=>
      bool(true)
      ["type"]=>
      string(6) "Mobile"
      }
      }
      ["phoneNumber"]=>
      string(6) "543254"
      ["emailAddressData"]=>
      array(0) {
      }
      ["emailAddress"]=>
      NULL
      ["emailAddressIsOptedOut"]=>
      NULL
      ["addressCity"]=>
      string(0) ""
      ["addressPostalCode"]=>
      string(0) ""
      ["addressStreet"]=>
      string(0) ""
      ["addressState"]=>
      string(0) ""
      ["addressCountry"]=>
      string(0) ""
      ["cursosName"]=>
      NULL
      ["cursosId"]=>
      NULL
      ["website"]=>
      string(0) ""
      ["description"]=>
      string(0) ""
      ["teamsIds"]=>
      array(0) {
      }
      ["teamsNames"]=>
      object(stdClass)#167 (0) {
      }
      }
      Last edited by romulo; 11-16-2018, 11:59 AM.
  • romulo
    Junior Member
    • Nov 2018
    • 9

    #3
    hi, i "resolved" with $data = json_decode(json_encode($data), True);, but i don't know if is a better way, and if it's is a espo error or bug, can you to include and a new update?

    tanks

    Comment

    Working...