php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #59860 Does not conform to suggested YAML 1.1 spec
Submitted: 2011-07-19 10:59 UTC Modified: 2012-01-25 06:46 UTC
From: austin109 at gmail dot com Assigned: bd808 (profile)
Status: Closed Package: yaml (PECL)
PHP Version: 5.3.5 OS: BSD
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: austin109 at gmail dot com
New email:
PHP Version: OS:

 

 [2011-07-19 10:59 UTC] austin109 at gmail dot com
Description:
------------
According to the YAML 1.1 spec (http://yaml.org/spec/1.1/#non-specific%20tag/):

(1) During parsing, nodes that omit the tag are given a non-specific tag: ??? for plain scalars and ?!? for all other nodes
(2) It is recommended that nodes having the "!" non-specific tag should be resolved as "tag:yaml.org,2002:seq", "tag:yaml.org,2002:map" or "tag:yaml.org,2002:str" depending on the node?s kind

From what I can tell, the extension ignores the recommendations for resolving sequences and maps without an explicit tag, for both inline and block styles.

Reproduce code:
---------------
function tag_cb($tag,$obj,$style) { echo "Found tag $tag\n"; }

$yaml = <<<YAML
implicit_map:
  a: b
explicit_map: !!map
  c: d
implicit_seq: [e, f]
explicit_seq: !!seq [g, h]
YAML;

yaml_parse($yaml,0,$ndocs,array(YAML_MAP_TAG => 'tag_cb', YAML_SEQ_TAG => 'tag_cb'));


Expected result:
----------------
Found tag tag:yaml.org,2002:map //implicit
Found tag tag:yaml.org,2002:map //explicit
Found tag tag:yaml.org,2002:seq //implicit
Found tag tag:yaml.org,2002:seq //explicit

Actual result:
--------------
Found tag tag:yaml.org,2002:map //explicit
Found tag tag:yaml.org,2002:seq //explicit

Patches

Fix-59860 (last revision 2012-01-17 23:04 UTC by lucas at stumbleupon dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-25 06:45 UTC] bd808@php.net
Automatic comment from SVN on behalf of bd808
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=322707
Log: Patch for #59860 from lucas at stumbleupon dot com
 [2012-01-25 06:46 UTC] bd808@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: bd808
 [2012-01-25 06:46 UTC] bd808@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Implemented using lucas at stumbleupon dot com's patch.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jan 05 03:01:28 2025 UTC