Zend Framework

Zend_Feed should introduce a method of turning off exceptions

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Minor Minor
  • Resolution: Not an Issue
  • Affects Version/s: 1.5.2
  • Fix Version/s: None
  • Component/s: Zend_Feed
  • Labels:
    None

Description

I like to take certain actions that occur on the site and push them into the destructor or shutdown functions. This gives you the functionality of having a background "task" that can run. For instance, on a larger site, I can have some miscellaneous database cleanup occur every hour in the shutdown function - won't affect users much, and I can have it run regularly (based on activity).

I'm working on RSS importing functionality and have pushed this into my tasks system as well. Each user configures the RSS feeds they want to import, and then once an hour I figured I'd just import the next 5 or so that need to be imported.

The problem I've run into is that Zend_Feed throws exceptions and has no way to shut them off. Due to this PHP "bug" (which I've discovered also applies to register_shutdown_function) when Zend_Feed does this you get a Fatal error printed to the screen (and in my case the "task" gets locked): http://bugs.php.net/bug.php?id=33598

I would like to see a configuration option that can be passed to Zend Feed (perhaps to the import method or to a standalone disableExceptions method, though I'm open on this one) whereby you can shutdown exceptions either temporarily, or until you turn them back on explicitly. This would allow you to use Zend_Feed in the destructor properly. Given that it can take a few moments to import an RSS feed (due to the nature of the operation), doing this functionality in the destructor when possible provides a smoother and seemingly faster experience to the end user. For now, I'm going to have to pull RSS importing or my entire task system functionality out of the desctructor entirely, which is unfortunate.

Activity

Hide
Pádraic Brady added a comment -

OP needs to understand that disabling exceptions still needs a replacement (e.g. logging/reporting). At this time, it's unlikely to be added. In addition, the documented behaviour of Exception should dissuade the use of destructors. Viable alternatives include scheduled tasks or job queues.

Show
Pádraic Brady added a comment - OP needs to understand that disabling exceptions still needs a replacement (e.g. logging/reporting). At this time, it's unlikely to be added. In addition, the documented behaviour of Exception should dissuade the use of destructors. Viable alternatives include scheduled tasks or job queues.

People

Vote (0)
Watch (2)

Dates

  • Created:
    Updated:
    Resolved: