aboutsummaryrefslogtreecommitdiffhomepage
path: root/php/src
diff options
context:
space:
mode:
authorGravatar Paul Yang <TeBoring@users.noreply.github.com>2017-07-13 11:21:03 -0700
committerGravatar GitHub <noreply@github.com>2017-07-13 11:21:03 -0700
commit3a0382e9076bdbb7c764080c92f3c2324d852be7 (patch)
tree61c1b903d5db55e23c2c60ec1b0829d1fcf06453 /php/src
parentd3bbf1c8a98fe01c115f525c516e575d87c11a47 (diff)
Add map iterator for c extension (#3350)
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;
}