Fix bug in max_depth if depth set to 0, a=chris

Chris Pollett [2019-06-11 22:Jun:th]
Fix bug in max_depth if depth set to 0, a=chris
Filename
src/executables/Fetcher.php
src/executables/QueueServer.php
diff --git a/src/executables/Fetcher.php b/src/executables/Fetcher.php
index 576564086..0ddf7436a 100755
--- a/src/executables/Fetcher.php
+++ b/src/executables/Fetcher.php
@@ -2416,7 +2416,7 @@ class Fetcher implements CrawlConstants
         // decode 3 bytes weight 1 byte depth
         list($old_weight, $old_depth) = L\decodeQueueWeightInfo(
             $old_weight_pair, $this->crawl_order);
-        if ($this->max_depth > 0 && $old_depth + 1 >= $this->max_depth) {
+        if ($this->max_depth >= 0 && $old_depth + 1 > $this->max_depth) {
             return; // reached max depth so don't add any urls
         }
         $sitemap_link_weight = 0.25;
diff --git a/src/executables/QueueServer.php b/src/executables/QueueServer.php
index 8cb5eb76e..f27057596 100755
--- a/src/executables/QueueServer.php
+++ b/src/executables/QueueServer.php
@@ -1032,11 +1032,12 @@ class QueueServer implements CrawlConstants, Join
         $crawl_status['MOST_RECENT_FETCHER'] = "";
         $crawl_status['MOST_RECENT_URLS_SEEN'] = [];
         $crawl_status['CRAWL_TIME'] = $this->crawl_time;
-        $crawl_status['REPEAT_TYPE'] = (empty($this->repeat_type)) ?
+        $crawl_status['REPEAT_TYPE'] = (!isset($this->repeat_type)) ?
             -1 : $this->repeat_type;
-        $crawl_status['MAX_DEPTH'] = (empty($this->max_depth)) ?
+        //value might be 0 so don't use empty use !isset
+        $crawl_status['MAX_DEPTH'] = (!isset($this->max_depth)) ?
             -1 : $this->max_depth;
-        $crawl_status['ROBOTS_TXT'] = (empty($this->robots_txt)) ?
+        $crawl_status['ROBOTS_TXT'] = (!isset($this->robots_txt)) ?
             C\ALWAYS_FOLLOW_ROBOTS : $this->robots_txt;
         $crawl_status['COUNT'] = 0;
         $crawl_status['DESCRIPTION'] = $message;
@@ -2247,14 +2248,14 @@ class QueueServer implements CrawlConstants, Join
         }
         $crawl_status['CRAWL_TIME'] = $this->crawl_time;
         $crawl_status['CHANNEL'] = $this->channel;
-        $crawl_status['REPEAT_TYPE'] = (empty($this->repeat_type)) ?
+        $crawl_status['REPEAT_TYPE'] = (!isset($this->repeat_type)) ?
             -1 : $this->repeat_type;
         if (!empty($this->index_archive->repeat_time)) {
             $crawl_status['REPEAT_TIME'] = $this->index_archive->repeat_time;
         }
-        $crawl_status['ROBOTS_TXT'] = (empty($this->robots_txt)) ?
+        $crawl_status['ROBOTS_TXT'] = (!isset($this->robots_txt)) ?
             C\ALWAYS_FOLLOW_ROBOTS : $this->robots_txt;
-        $crawl_status['MAX_DEPTH'] = (empty($this->max_depth)) ?
+        $crawl_status['MAX_DEPTH'] = (!isset($this->max_depth)) ?
             -1 : $this->max_depth;
         $index_archive_class = C\NS_LIB . (($crawl_status['REPEAT_TYPE'] > 0 ) ?
             "DoubleIndexBundle" : "IndexArchiveBundle");
ViewGit