My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 51: PHP port does not correctly handle repeated sections
1 person starred this issue and may be notified of changes. Back to list
Status:  New
Owner:  ----
Cc:  sroussey


 
Reported by brian.ho...@gmail.com, Feb 10, 2010
What steps will reproduce the problem?
You can compare the Python version with the PHP version by running this simple test from the command line.  It works correctly in 
Python, and fails in PHP.

$ python expand.py '{.repeated section list}{.section test}{@index}. Test is TRUE{.newline}{.or}{@index}. Test is 
FALSE{.newline}{.end}{.end}' '{"list": [{"test": true},{"test": false},{"test": true},{"test": false}]}'
1. Test is TRUE
2. Test is FALSE
3. Test is TRUE
4. Test is FALSE

$ php -f jsontemplate_cmd.php '{.repeated section list}{.section test}{@index}. Test is TRUE{.newline}{.or}{@index}. Test is 
FALSE{.newline}{.end}{.end}' '{"list": [{"test": true},{"test": false},{"test": true},{"test": false}]}'
1. Test is TRUE
2. Test is FALSE

What is the expected output? What do you see instead?
The results of the template should be 4 lines of output, as seen with the Python version.  In PHP, it exists after the first two lines. 

What version of the product are you using? On what operating system?
I have the latest from Mercurial repository.

Please provide any additional information below.
It seems like the PHP port fails when there is a {.section} inside of the {.repeated section}.  This may be messing up its internal stack.
Feb 11, 2010
#1 brian.ho...@gmail.com
This actually appears to be related to handling of boolean JSON values.  If, instead of "False", the value of "test" 
is undefined, then the PHP port gives the expected output.

$ php -f jsontemplate_cmd.php '{.repeated section list}{.section test}{@index}. Test is 
TRUE{.newline}{.or}{@index}. Test is 
FALSE{.newline}{.end}{.end}' '{"list": [{"test": true},{},{"test": true},{}]}'
1. Test is TRUE
2. Test is FALSE
3. Test is TRUE
4. Test is FALSE

Feb 17, 2010
Project Member #2 sroussey
(No comment was entered for this change.)
Cc: sroussey

Powered by Google Project Hosting