diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-07-13 11:21:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-13 11:21:03 -0700 |
commit | 3a0382e9076bdbb7c764080c92f3c2324d852be7 (patch) | |
tree | 61c1b903d5db55e23c2c60ec1b0829d1fcf06453 /php/src/Google/Protobuf/Internal | |
parent | d3bbf1c8a98fe01c115f525c516e575d87c11a47 (diff) | |
download | protobuf-3a0382e9076bdbb7c764080c92f3c2324d852be7.tar.gz protobuf-3a0382e9076bdbb7c764080c92f3c2324d852be7.tar.bz2 protobuf-3a0382e9076bdbb7c764080c92f3c2324d852be7.zip |
Add map iterator for c extension (#3350)
Diffstat (limited to 'php/src/Google/Protobuf/Internal')
-rw-r--r-- | php/src/Google/Protobuf/Internal/MapFieldIter.php | 5 |
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; } |