Sfoglia il codice sorgente

Allow "0" to be used as a key

Greg Dickson 7 anni fa
parent
commit
3222d2b4b6
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  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?');
             }