[JobQueue] Added type-guard checks to JobQueueGroup::push().
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 17 Oct 2012 18:38:19 +0000 (11:38 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 17 Oct 2012 18:38:24 +0000 (11:38 -0700)
Change-Id: If41820aab396697546361bc83ba6ce26d08311d8

includes/job/JobQueueGroup.php

index 7d01a29..2f94152 100644 (file)
@@ -87,7 +87,11 @@ class JobQueueGroup {
 
                $jobsByType = array(); // (job type => list of jobs)
                foreach ( $jobs as $job ) {
-                       $jobsByType[$job->getType()][] = $job;
+                       if ( $job instanceof Job ) {
+                               $jobsByType[$job->getType()][] = $job;
+                       } else {
+                               throw new MWException( "Attempted to push a non-Job object into a queue." );
+                       }
                }
 
                $ok = true;