diff options
author | Paul Yang <TeBoring@users.noreply.github.com> | 2017-04-19 16:23:51 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-19 16:23:51 -0700 |
commit | 190b5270c8717ca343db42da489e5e7d6d9efb2c (patch) | |
tree | 3815f20268bc56aac88267004149f9e4eb634223 /php/src/Google/Protobuf | |
parent | 43234828da6ae3a3a3ada25d11488fdfd080b79c (diff) |
Make PHP c extension work with PHP7 (#2951)
Diffstat (limited to 'php/src/Google/Protobuf')
-rw-r--r-- | php/src/Google/Protobuf/Internal/MapField.php | 3 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/RepeatedField.php | 4 |
2 files changed, 7 insertions, 0 deletions
diff --git a/php/src/Google/Protobuf/Internal/MapField.php b/php/src/Google/Protobuf/Internal/MapField.php index 68c10c08..f65bd9b8 100644 --- a/php/src/Google/Protobuf/Internal/MapField.php +++ b/php/src/Google/Protobuf/Internal/MapField.php @@ -284,6 +284,9 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable GPBUtil::checkString($value, true); break; case GPBType::MESSAGE: + if (is_null($value)) { + trigger_error("Map element cannot be null.", E_USER_ERROR); + } GPBUtil::checkMessage($value, $this->klass); break; default: diff --git a/php/src/Google/Protobuf/Internal/RepeatedField.php b/php/src/Google/Protobuf/Internal/RepeatedField.php index 0dc5d9d2..2ad4709a 100644 --- a/php/src/Google/Protobuf/Internal/RepeatedField.php +++ b/php/src/Google/Protobuf/Internal/RepeatedField.php @@ -225,6 +225,10 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable GPBUtil::checkString($value, true); break; case GPBType::MESSAGE: + if (is_null($value)) { + trigger_error("RepeatedField element cannot be null.", + E_USER_ERROR); + } GPBUtil::checkMessage($value, $this->klass); break; default: |