aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/src
diff options
context:
space:
mode:
Diffstat (limited to 'php/src')
-rw-r--r--php/src/Google/Protobuf/Internal/MapFieldIter.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/php/src/Google/Protobuf/Internal/MapFieldIter.php b/php/src/Google/Protobuf/Internal/MapFieldIter.php
index cb707955..88e6c8b2 100644
--- a/php/src/Google/Protobuf/Internal/MapFieldIter.php
+++ b/php/src/Google/Protobuf/Internal/MapFieldIter.php
@@ -91,9 +91,12 @@ class MapFieldIter implements \Iterator
public function key()
{
$key = key($this->container);
- // PHP associative array stores bool as integer for key.
if ($this->key_type === GPBType::BOOL) {
+ // PHP associative array stores bool as integer for key.
return boolval($key);
+ } elseif ($this->key_type === GPBType::STRING) {
+ // PHP associative array stores int string as int for key.
+ return strval($key);
} else {
return $key;
}