Quellcode durchsuchen

Allow "0" to be used as a key

Greg Dickson vor 7 Jahren
Ursprung
Commit
3222d2b4b6
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  1. 1 1
      lib/Mongo/MongoCollection.php

+ 1 - 1
lib/Mongo/MongoCollection.php

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