mustangostang / spyc

A simple YAML loader/dumper class for PHP
MIT License
712 stars 207 forks source link

weird issue: ssh key not parsed correctly #43

Closed iahim closed 9 years ago

iahim commented 9 years ago

i have a yaml file where i store some ssh pub keys:

sshkeys:
  - ssh-rsa A---LOOOONG-SSH-KEY---rxs=  some comment

when reading the yaml i get the correct value

[sshkeys] => Array
        (
            [0] => ssh-rsa A---LOOOONG-SSH-KEY---rxs=  some comment

BUT when writing that value back to the yaml file....i get this:

sshkeys:
  - >
    ssh-rsa
    A--LONG-KEY=
    comment root key

THE result is split into 4 lines ... with the weird ">" and the key on 3 lines instead of one.

Any idea? Thank you kindly

IngwiePhoenix commented 9 years ago

When you parse the output file again, do you get the correct key? Otherwise, the length of the string might just be wrapped down. So instead of one line of 80 characters, the printer generates 2 lines of 40 characters instead.

Am 26.01.2015 um 14:58 schrieb Mihai Molnar notifications@github.com:

i have a yaml file where i store some ssh pub keys:

sshkeys:

ssh-rsa A---LOOOONG-SSH-KEY---rxs= some comment when reading the yaml i get the correct value [sshkeys] => Array ( [0] => ssh-rsa A---LOOOONG-SSH-KEY---rxs= some comment

BUT when writing that value back to the yaml file....i get this:

sshkeys:

ssh-rsa A--LONG-KEY= eprod-web01 root key THE result is split into 4 lines ... with the weird ">" and the key on 3 lines instead of one.

Any idea? Thank you kindly

— Reply to this email directly or view it on GitHub https://github.com/mustangostang/spyc/issues/43.

iahim commented 9 years ago

@IngwiePhoenix Thanks for your reply. It seems that you are right, that is somehow wrapped... but that is a major issue to me.. because that yaml file is being read by another app as well... and this wrapping just breaks the program. Is there a way to disable this wrapping... and keep a long line?

Thanks in advance, Mike

iahim commented 9 years ago

@IngwiePhoenix i think i have found the solution.

Spyc::YAMLDump($array, $indent = false, $wordwrap = 0, $no_opening_dashes = false);

the value 0 for wordwrap makes it work.

Thanks for your time! This can be removed/marked as solved.