Give the gift of Drupal. All merchandise is 50% off through 2016.
While working on, I discovered that Batch API freaks out if $context['finished'] > 1. Hat tip to chx for asking in IRC "wonder what our little batch does if you set finished to 102%" (paraphrase). Anyway, the answer is "it never terminates". ;) Our Batch API unit tests are woefully insufficient to catch this. All they do is ensure that _batch_api_percentage() returns valid output on valid input. Great. Hurray for unit testing! Testing individual functions is so much more important than seeing if the end-to-end system works -- and it's easier to debug this way!... yeah, right. ;)
Anyway, this isn't just a case of "core shouldn't baby sit broken code". If you're using batches for draining queues, and queues can be populated in other threads, this is a potentially common case. It'd be nice if unexpected input didn't trigger an infinite loop, especially since there's basically 0 performance cost in getting this right.
|#20||600836-batch-prevent-infinite.patch||480 bytes||Dave Reid|
PASSED: [[SimpleTest]]: [MySQL] 190 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 25,365 pass(es). View
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 600836-timcosgrove-batch-never-finishes.patch. View
PASSED: [[SimpleTest]]: [MySQL] 19,939 pass(es). View
PASSED: [[SimpleTest]]: [MySQL] 20,944 pass(es). View