storage test
[m6w6/pq-gateway] / lib / pq / Query / AsyncExecutor.php
index a61f87a868cca08df0729562ba35cd43a29ad6b3..4b58a995e7ad942fe73fee0d4c7621e845e773df 100644 (file)
@@ -103,7 +103,9 @@ class AsyncExecutor extends Executor
                
                $context = $init();
                foreach (func_get_args() as $cb) {
-                       $then($context, $cb);
+                       if (is_callable($callback)) {
+                               $then($context, $cb);
+                       }
                }
                
                return array($context, function($result) use ($context, $done) {
@@ -117,7 +119,7 @@ class AsyncExecutor extends Executor
         * @param callable $callback result callback
         * @return mixed context created by the init callback
         */
-       function execute(WriterInterface $query, callable $callback) {
+       function execute(WriterInterface $query, callable $callback = null) {
                $this->result = null;
                $this->query = $query;
                $this->notify();