sabre-io / dav

sabre/dav is a CalDAV, CardDAV and WebDAV framework for PHP
http://sabre.io
BSD 3-Clause "New" or "Revised" License
1.51k stars 344 forks source link

Inconsitent logic #88

Closed evert closed 11 years ago

evert commented 11 years ago

Original author: lars.kne...@gmail.com (March 08, 2012 06:57:07)

$summary = null;

This one works: $compoent->add(new Sabre_VObject_Property('DESCRIPTION', $summary));

This one not: $compoent->add('DESCRIPTION', $summary);

Because Sabre_VObject_Component::add checks if $itemValue is a scalar. Unfortunately null is no scalar. But the Sabre_VObject_Property which is created on demand accepts null as value.

I would propose two things.

If null is allowed as value the check should be extended to test the value to be either null or scalar. Move the check if $itemvalue is valid to the Sabre_VObject_Property. This class should know best which values it can accept.

Original issue: http://code.google.com/p/sabredav/issues/detail?id=197

evert commented 11 years ago

From evert...@gmail.com on March 08, 2012 10:56:18: Makes sense to fix this, thanks!

evert commented 11 years ago

From evert...@gmail.com on September 16, 2012 19:37:21: Fixed by this commit:

https://github.com/evert/sabre-vobject/commit/cc1957814ed85b7e1523f8ccb86e5d0ceb4ee9fa