Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.3
    • Fix Version/s: None
    • Component/s: File Parser
    • Labels:
      None
    • Environment:
      PHP 5.3.3-1ubuntu9.1

      Description

      With a valid Json file :
      PHP Warning: explode() expects parameter 2 to be string, object given in Doctrine/Doctrine/Import/Schema.php on line 381
      PHP Catchable fatal error: Object of class stdClass could not be converted to string in Doctrine/Doctrine/Import/Schema.php on line 391

      It's due to this line, line, in Doctrine/Parser/Json.php (#65) :
      $json = json_decode($contents);

      It should be:
      $json = json_decode($contents, true);

      Because casting the result as array will only affect the top-level element. You must use the second parameter of json_decode() to force every objects (including sub-objects) to be converted to indexed arrays.

        Activity

        Hide
        Mael Nison added a comment -

        A try to import this file should fail.

        Show
        Mael Nison added a comment - A try to import this file should fail.
        Hide
        Brian Fenton added a comment -

        I've submitted a pull request w/patch and unit test for this issue using the fix above. I had the same problem in my code on OS X 10.6.4, PHP 5.3.2

        Show
        Brian Fenton added a comment - I've submitted a pull request w/patch and unit test for this issue using the fix above. I had the same problem in my code on OS X 10.6.4, PHP 5.3.2

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Mael Nison
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: