[DC-936] json schema import broken Created: 22/Nov/10  Updated: 22/Dec/10

Status: Open
Project: Doctrine 1
Component/s: File Parser
Affects Version/s: 1.2.3
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Mael Nison Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None
Environment:

PHP 5.3.3-1ubuntu9.1


Attachments: File foobar.schema.json    

 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.



 Comments   
Comment by Mael Nison [ 22/Nov/10 ]

A try to import this file should fail.

Comment by Brian Fenton [ 22/Dec/10 ]

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





[DC-392] Let the parser ignore .* (hidden) files Created: 02/Jan/10  Updated: 08/Jun/10

Status: Open
Project: Doctrine 1
Component/s: File Parser
Affects Version/s: 1.1.6
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: Alessandro Vermeulen Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 0
Labels: None


 Description   

When generating models from yml files starting with a `.' such as temporary files from certain editors and meta files from OS X are also parsed by the importer. I do not see any reasons too include these hidden files in parsing as they are hidden for a purpose. And there would be no point in deliberately using hidden files for your config files.

Also see:
http://blog.rajatpandit.com/2009/08/23/doctrine_parser_exception-fail-some-error-message/
and
http://alessandrovermeulen.me/2010/01/01/doctrine-unable-to-parse-string-unable-to-parse-line-0/



 Comments   
Comment by Alessandro Vermeulen [ 02/Jan/10 ]

Added affected versions.

Comment by Jonathan H. Wage [ 08/Jun/10 ]

We can include this fix in 1.2.3, does anyone have a patch? If not I'll try and hunt down the offending code and patch it. Not sure where it is off the top of my head anymore





Generated at Fri Apr 18 13:21:07 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.