Development

#2622 (symfony should workaround spyc's "undefined index" warning when parsing malformed yaml files)

You must first sign up to be able to contribute.

Ticket #2622 (closed defect: fixed)

Opened 1 year ago

Last modified 8 months ago

symfony should workaround spyc's "undefined index" warning when parsing malformed yaml files

Reported by: b166er Assigned to: fabien
Priority: minor Milestone: 1.1.0
Component: generator Version: 1.1.0 DEV
Keywords: spyc Cc:
Qualification: Unreviewed

Description

it is better to use isset() before access to assoc-array.

Notice: Undefined index: in /usr/share/php/symfony/util/Spyc.class.php on line 201

Notice: Undefined offset: 0 in /usr/share/php/symfony/util/Spyc.class.php on line 921

patch is included

Attachments

spyc.patch (4.8 kB) - added by b166er on 12/05/07 12:35:26.
patch with isset check

Change History

12/05/07 12:35:26 changed by b166er

  • attachment spyc.patch added.

patch with isset check

01/22/08 10:36:04 changed by Markus.Wagner

I think I have the same problem:

error messages:

(4 times) Notice: Undefined index: in /usr/share/php5/PEAR/symfony/util/Spyc.class.php on line 203
(4 times) Notice: Undefined offset: 0 in /usr/share/php5/PEAR/symfony/util/Spyc.class.php on line 923

I use symfony 1.0.10 and my page ist generated with admin generator and has a edit.yml-Validator-File.

If I reload the page, the error messages disappear.

01/22/08 14:28:18 changed by Markus.Wagner

sorry, my fault: I forgot ":" at the end of my fieldname, in my edit.yml file. I fixed my edit.yml and the error message does not appear anymore.

01/24/08 21:47:46 changed by b166er

anyway, its not change on the fact, that on the reported lines is a error. it's a very simple bugfix, if u trust me, i can also fix this bug, and close this ticket. (i have alreade svn-account)

03/13/08 07:58:01 changed by Carl.Vondrick

  • summary changed from Undefined index in Spyc to symfony should workaround spyc's "undefined index" warning when parsing malformed yaml files.

Wouldn't it be better to throw an exception that the configuration is malformed?

03/13/08 09:12:01 changed by b166er

Yes of course, it would be. anyway, first of all we need to patch spyc, to close php notice messages. Than it would be very nice, if spyc first validate yml-file and throw Exception on malformed file. or anybody got a better idea?

03/13/08 12:20:13 changed by fabien

If someone can come up with a YAML validation tool, it would be great... good luck ;)

03/14/08 21:57:34 changed by fabien

  • milestone set to 1.1.0.

03/14/08 22:59:38 changed by fabien

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

(In [7892]) replaced Spyc with a new YAML parser/dumper (closes #3083, #2887, #2622, #2514, #1966, #1339, #3016)

  • removed Spyc
  • added sfYamlParser, sfYamlDumper (should be totally BC thanks to the unit tests)
  • the parser and the dumper are much more robust and much more easier to fix
  • exceptions are thrown when a non valid YAML file is parsed (when you forget a : after a key for example, or if the indentation is not right ;))
  • fixed a bunch of bugs of the old parser
  • speed is more or less the same as Spyc
  • added an option to control the dump to switch from the block to the flow notation (propel:build-schema is now much more readable in YAML)
  • added more unit tests