#8398 (sfYaml - incorrectly removes lines starting with a # within a text block)

You must first sign up to be able to contribute.

Ticket #8398 (reopened defect)

Opened 4 years ago

Last modified 4 years ago

sfYaml - incorrectly removes lines starting with a # within a text block

Reported by: pookey Assigned to: fabien
Priority: minor Milestone:
Component: yaml Version: 1.4.3
Keywords: Cc:
Qualification: Unreviewed


text: |
  # this shouldn't be a comment

results in:


expected result:

  # this shouldn't be a comment

Change History

03/12/10 06:21:41 changed by Kris.Wallsmith

Can you reference the section of the YAML specification that states this?

03/12/10 14:54:39 changed by fabien

Just tested it with symfony 1.4 and the YAML component and it works perfectly. Can you check again?

03/12/10 15:08:54 changed by pookey

Sorry, I was meaning to spend more time looking at this and add detail - I reported it quickly so I didn't forget

s$ cat test.yml
  cow: fish
  ret: |

tested with:

    $ret = sfYaml::load('test.yml');

results in:

array(1) {
  array(2) {
    string(4) "fish"
    string(5) "test

notice only 1 'test' - not two.

This is incorrect according to my understanding of the spec founce here:

03/12/10 15:20:47 changed by fabien

This is definitely a bug.

It works only on the first level:

{{{ret: |

#test test


cow: fish ret: |

#test test


The first ret will have the comment, whereas the second one won't.

I will have a look at it.

03/12/10 15:56:17 changed by fabien

  • status changed from new to closed.
  • resolution set to fixed.

(In [28508]) [YAML] fixed parsing of folded scalars when a # sign starts a line (closes #8398)

03/12/10 17:40:33 changed by benj.clay

  • status changed from closed to reopened.
  • resolution deleted.

The change [28508] broke something.

php symfony doctrine:build --all --and-load --no-confirmation && php symfony cc

  Unable to parse file "/lib/vendor/symfony/lib/config/config/settings.yml": Indentation problem at line 39 ( # Determines which events are logged.)

03/12/10 17:47:55 changed by Seldaek

We also have a problem here with this throwing an exception:

#         5 === Doctrine_Core::EXPORT_ALL ^ Doctrine_Core::EXPORT_CONSTRAINTS
          "Doctrine_Core::ATTR_EXPORT": 5

03/12/10 17:49:06 changed by lsmith

Indeed. Here is a reproduce for the breakage I am seeing:

# my comment
    ding: dong

03/12/10 17:54:55 changed by Kris.Wallsmith

(In [28511]) [YAML] reverted r28508 (refs #8398)