From 9114b0f7242ebbd0334245e04b3fd366df05ca73 Mon Sep 17 00:00:00 2001 From: Chris Coley Date: Fri, 2 Nov 2018 10:52:53 -0700 Subject: [PATCH] Fix an off-by-one error when parsing the index from the config Fixes #7 and #8 --- src/zc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zc.php b/src/zc.php index c3605dc..a472535 100644 --- a/src/zc.php +++ b/src/zc.php @@ -342,7 +342,7 @@ public function setConfig($keyChain, $val) { $indexEnd = strpos($chain[0], "]"); if ($indexStart > -1) { - $index = (substr($chain[0], $indexStart+1, ($indexEnd-$indexStart)+1))*1; + $index = (int) substr($chain[0], $indexStart+1, ($indexEnd-$indexStart)-1); $parentKey = substr($chain[0], 0, $indexStart); if (count($chain[1])) { $this->config[$parentKey][$index][$chain[1]] = $val;