[#7843] yaml loader fails if string contain curly brackets
Summary yaml loader fails if string contain curly brackets
Queue Horde Framework Packages
Queue Version Git master
Type Bug
State Assigned
Priority 2. Medium
Owners chuck (at) horde (dot) org, mike (at) naberezny (dot) com
Requester eero.afheurlin (at) nemein (dot) com
Created 2009-01-13 (4669 days ago)
Updated 2010-09-24 (4050 days ago)
Assigned 2009-01-13 (4669 days ago)
Patch No

2010-09-24 22:20:51 Jan Schneider Version ⇒ Git master
2009-03-21 11:39:50 eero (dot) afheurlin (at) nemein (dot) com Comment #2 Reply to this comment
using single-quotes in stead of double-quotes works around the issue 
on the old spyc at least (and the last time I looked you used the same 
code for parsing).

syck does not care about quoting or such, it "just works"
2009-01-13 15:56:00 Chuck Hagenbuch Assigned to Chuck Hagenbuch
Assigned to Mike Naberezny
State ⇒ Assigned
2009-01-13 15:31:20 Chuck Hagenbuch Version ⇒ HEAD
2009-01-13 15:27:46 eero (dot) afheurlin (at) nemein (dot) com Comment #1
Type ⇒ Bug
State ⇒ Unconfirmed
Priority ⇒ 2. Medium
Summary ⇒ yaml loader fails if string contain curly brackets
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
Reply to this comment
Consider the following yaml snippet




         controller: net_nemein_news_controllers_index

         action: latest

         route: /

         content_entry_point: nnn-show-latest


             - OPTIONS

             - GET

             - PROPFIND


         controller: net_nemein_news_controllers_index

         action: latest

         route: "/latest/{$int:number}/"

         content_entry_point: nnn-show-latest


         controller: net_nemein_news_controllers_index

         action: latest

         route: /rss.xml

         mimetype: text/xml

         template_entry_point: nnn-show-rss


         controller: net_nemein_news_controllers_article

         action: show

         route: "/{$name}/"

         content_entry_point: nnn-show-article


         controller: net_nemein_news_controllers_article

         action: edit

         route: "/{$name}/edit"

         content_entry_point: nnn-edit-article


This has the same bug as spyck in the parser (supposedly) thinking 
that the curly brackets inside strings are inline maps

syck parses this correctly even when the routes with curly brackets 
are not quoted.

tested on "PHP 5.2.0-8+etch11 (cli)" using the following code and 
horde/Yaml-1.0.1 via PEAR.








$path = realpath(dirname(__FILE__)) . '/test.yml';

echo "path={$path}\n";

$array = Horde_Yaml::load($path);

if (   !(   isset($array['routes'])

          && isset($array['routes']['latest'])

          && isset($array['routes']['latest']['route'])

          && is_string($array['routes']['latest']['route']))

     || !(   isset($array['routes'])

          && isset($array['routes']['show'])

          && isset($array['routes']['show']['route'])

          && is_string($array['routes']['show']['route']))



     echo "ERROR: Invalidly parsed route\n";




echo "No  errors detected";



Saved Queries