ellenbrook / freshbooks-php-library

Automatically exported from code.google.com/p/freshbooks-php-library
0 stars 0 forks source link

_getTagXML() should not use an empty string to designate fields to skip #4

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
In FreshBooks_Element, the _getTagXML() method does not generate tags for
elements that have an empty string for a value. This makes it exceedingly
difficult for an application that is using FreshBooks PHP to clear a
previously-populated property of a FreshBooks object.

For example, consider a FreshBooks Client that has an secondary address. If
an application wants to clear it out on the FreshBooks site, the FreshBooks
API docs on developers.freshbooks.com indicate that the application needs
to send the client.update request and specify "s_street1", "s_street2", etc
tags without any values inside. But, if the application is using FreshBooks
PHP, setting $client->sStreet1 and $client->sStreet2 to empty strings will
cause them not to be transmitted.

I recommend switching this behavior over to using NULL as the indicator of
whether a field should be skipped, and using the PHP strict equals operator
(===) in the comparison.

Original issue reported on code.google.com by Guy.Padd...@gmail.com on 27 Apr 2010 at 4:33

GoogleCodeExporter commented 9 years ago

Original comment by xXBiohaz...@gmail.com on 14 Apr 2011 at 11:07