Last modified: 2011-04-18 12:26:21 UTC
If a string starts with a newline but does trigger any other condition in Spyc::_needLiteral(), Spyc fails to write it to the YAML output as a literal (i.e. starting with |- and properly escaped). This is because strpos( $value, "\n" ) returns 0, which is interpreted as false. This bug causes Perl's YAML module and possibly other loaders to choke on the YAML. The trivial fix is to change line 167 of phase3/includes/libs/spyc.php from strpos( $value, "\n" ) || to strpos( $value, "\n" ) !== false || Example of a query that triggers this bug: http://de.guttenplag.wikia.com/api.php?action=query&format=yaml&prop=revisions&rvprop=content&titles=Benutzer:Kahrl/YamlBug Example of a query that triggers but does not show this bug (because there's also a # in the string): http://de.guttenplag.wikia.com/api.php?action=query&format=yaml&prop=revisions&rvprop=content&titles=Benutzer:Kahrl/YamlBug2
s/does trigger/does not trigger/, of course.
Probably no longer needed due to r86302.
I'm CC'd to this bug and didn't even know it existed. http://de.guttenplag.wikia.com/api.php?action=query&format=jsonfm&prop=revisions&rvprop=content&titles=Benutzer:Kahrl/YamlBug JSON output looks WFM Marking fixed
Is this reported to spyc?
(In reply to comment #4) > Is this reported to spyc? It seems this has already been fixed upstream. http://code.google.com/p/spyc/source/browse/trunk/spyc.php uses "strpos($value,"\n") !== false" in _dumpNode().