8000 Yaml interobability problem with PECL yaml · Issue #4135 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
Yaml interobability problem with PECL yaml #4135
Closed
@nonanet

Description

@nonanet

Symfony's YAML parser/dumper behaves differently than the PHP PECL yaml parser/dumper.

Example code:

<?php

require_once("Symfony/Component/Yaml/Parser.php");
require_once("Symfony/Component/Yaml/Yaml.php");
require_once("Symfony/Component/Yaml/Inline.php");
require_once("Symfony/Component/Yaml/Dumper.php");
require_once("Symfony/Component/Yaml/Unescaper.php");
require_once("Symfony/Component/Yaml/Escaper.php");
require_once("Symfony/Component/Yaml/Exception/ExceptionInterface.php");
require_once("Symfony/Component/Yaml/Exception/DumpException.php");
require_once("Symfony/Component/Yaml/Exception/ParseException.php");


$data = array('data' => array('date' => array('cr=bla'), 'username' => 'foo'));

$yaml = (yaml_emit($data));

$parser = new Symfony\Component\Yaml\Parser();

$data2 = $parser->parse($yaml);

echo "ORIG\n";
var_dump($data);
echo "NEW:\n";
var_dump($data2);



?>

returns the following results:

ORIG
array(1) {
  ["data"]=>
  array(2) {
    ["date"]=>
    array(1) {
      [0]=>
      string(6) "cr=bla"
    }
    ["username"]=>
    string(3) "foo"
  }
}
NEW:
array(1) {
  ["data"]=>
  array(3) {
    ["date"]=>
    NULL
    [0]=>
    string(6) "cr=bla"
    ["username"]=>
    string(3) "foo"
  }
}

This is

alex@debvirt:~/work/EPPTest$ php -v
PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) (built: Jun 28 2011 13:13:26)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

alex@debvirt:~/work/EPPTest$ pecl list | fgrep yaml
yaml          1.0.1   stable

Installed packages, channel pear.symfony.com:
=============================================
Package Version State
Yaml    2.0.12  stable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0