Explorar o código

Allow "0" to be used as a key

Greg Dickson %!s(int64=7) %!d(string=hai) anos
pai
achega
3222d2b4b6
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  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?');
             }