Issues

ZF-2022: Property _reminder does not exist when using Zend_Gdata_Calendar demo

Description

Summary When running the Zend_Gdata_Calendar demo at demos/Zend/Gdata/Calendar.php, attempting to use the setReminder mode will cause the following error:

{panel}Stack trace:

0 .../library/Zend/Gdata/App/Base.php(324): Zend_Gdata_App_Base->__isset('_reminder')

1 .../demos/Zend/Gdata/Calendar.php(572): Zend_Gdata_App_Base->__set('reminder', Array)

2 .../demos/Zend/Gdata/Calendar.php(679): setReminder(Object(Zend_Http_Client), 'vsrdg4c2da04jsd...', '30')

3 {main}

thrown in .../library/Zend/Gdata/App/Base.php on line 344

Fatal error: Uncaught exception 'Zend_Gdata_App_InvalidArgumentException' with message 'Property _reminder does not exist' in .../library/Zend/Gdata/App/Base.php:344 Stack trace:

0 .../library/Zend/Gdata/App/Base.php(324): Zend_Gdata_App_Base->__isset('_reminder')

1 .../demos/Zend/Gdata/Calendar.php(572): Zend_Gdata_App_Base->__set('reminder', Array)

2 .../demos/Zend/Gdata/Calendar.php(679): setReminder(Object(Zend_Http_Client), 'vsrdg4c2da04jsd...', '30')

3 {main}

thrown in .../library/Zend/Gdata/App/Base.php on line 344{panel}

History This was originally reported by Rusu Mircea via zfmrketing@zend.com, then forwarded to the Zend_Gdata mailing list. Reference: <698DE66518E7CA45812BD18E807866CEB95188@us-ex1.zend.net>

Comments

Added issue history.

Attaching patch as [^ZF-2022_v1.patch].

Instead of following Rusu's suggestion, I went with $when->reminders instead of $when->setReminders in order to maintain consistency with the rest of the sample code.

$when->reminders isn't consistent either, unfortunately. For all other data model elements, we went by the name of the XML element for deciding the pluralization. However, we seem to use reminders instead of reminder here.

Would it make sense to add setReminder and getReminder aliases to the pluralized version of the functions to Zend_Gdata_Extension_When in order to maintain that consistency? (I realize some may argue that what we are currently doing is consistent, but consistently wrong. In hindsight, I might have changed this, but don't really have that privilege while maintaining backwards compat)

-Ryan

{quote}Would it make sense to add setReminder and getReminder aliases to the pluralized version of the functions to Zend_Gdata_Extension_When in order to maintain that consistency?{quote}

Yes, I think that would make sense.

The only thing that worries me is that, as mistakes happen over time (heaven forbid), we're going to start piling up duplicate methods such as the ones being proposed here. Does the ZF project have any guidelines as to how functions should be properly deprecated?

Agreed. I think the general plan is to keep the framework backwards compatible, but I will talk to Zend about what, if any, plans there are for deprecation of small things like this. My proposal would be to deprecate it with 1.1, and remove it with 1.2 or 1.3--- that should give plenty of time--- but I want to be in alignment with the overall deprecation guidelines.

(batch downgrading outstanding issues older than 1 year)

Whats the word on this?

I created a demo Google Calendar account and reproduced the original reporter's problem. The same account is set up in the ZF test suite to run the Google Calendar online test suite, so there are already events available in the calendar from running those tests:

Actions to reproduce:


[adam@zfdev trunk]$ cd demos/Zend/Gdata
[adam@zfdev Gdata]$ php Calendar.php outputCalendarByFullTextQuery zftest@lundrigan.ca ZFTest2011 Sat
Sat, 07 May 2011 16:32:09 +0000 (http://google.com/calendar/feeds/…) Starts: 2011-05-07T09:30:00.000-02:30 [adam@zfdev Gdata]$ php Calendar.php setReminder zftest@lundrigan.ca ZFTest2011 3q294cfda18ldbk0qn94ag84fo 10 PHP Fatal error: Uncaught exception 'Zend_Gdata_App_InvalidArgumentException' with message 'Property _reminder does not exist' in library/Zend/Gdata/App/Base.php:526 Stack trace: #0 library/Zend/Gdata/App/Base.php(506): Zend_Gdata_App_Base->__isset('_reminder') #1 demos/Zend/Gdata/Calendar.php(621): Zend_Gdata_App_Base->__set('reminder', Array) #2 demos/Zend/Gdata/Calendar.php(728): setReminder(Object(Zend_Gdata_HttpClient), '3q294cfda18ldbk...', '10') #3 {main} thrown in library/Zend/Gdata/App/Base.php on line 526

As the original submitter's patch shows, the reason this error occurs is due to the fact that the Zend_Gdata_Calendar demo incorrectly uses it's own API:


$when->reminder = array($reminder);

This should be:


$when->reminders = array($reminder);

As the latter is how reminders are set in both the component code and in the online unit test suite (see: Zend_Gdata_CalendarOnlineTest, Line 115)

When I make this change in the demo script and re-run, everything works A-OK:


[adam@zfdev Gdata]$ php Calendar.php setReminder zftest@lundrigan.ca ZFTest2011 3q294cfda18ldbk0qn94ag84fo 55
[adam@zfdev Gdata]$ 

The 55-minute reminder is now added: !gc_demo_image.PNG!

As such, I think the issue boils down to an error in the demo application and not in the component itself.

Patch applied to trunk r24025

Merged to release-1.11 in r24062