Jelajahi Sumber

Allow "0" to be used as a key

Greg Dickson 7 tahun lalu
induk
melakukan
3222d2b4b6
1 mengubah file dengan 1 tambahan dan 1 penghapusan
  1. 1 1
      lib/Mongo/MongoCollection.php

+ 1 - 1
lib/Mongo/MongoCollection.php

@@ -983,7 +983,7 @@ class MongoCollection
     private function checkKeys(array $array)
     {
         foreach ($array as $key => $value) {
-            if (empty($key) && $key !== 0) {
+            if (empty($key) && $key !== 0 && $key !== '0') {
                 throw new \MongoException('zero-length keys are not allowed, did you use $ with double quotes?');
             }