diff options
author | Louis Laugesen <louis.laugesen@gmail.com> | 2022-11-30 03:12:28 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-29 08:12:28 -0800 |
commit | cf89d1e75625ed46fdf365b1d691ddfaf586f0c0 (patch) | |
tree | ad431b3f33c9f83fe351b14a16fbe76377f99acb /php | |
parent | ad6054c60079c0b813f3354a822ffbf1b4a70ad0 (diff) | |
download | flatbuffers-cf89d1e75625ed46fdf365b1d691ddfaf586f0c0.tar.gz flatbuffers-cf89d1e75625ed46fdf365b1d691ddfaf586f0c0.tar.bz2 flatbuffers-cf89d1e75625ed46fdf365b1d691ddfaf586f0c0.zip |
Fix PHP byte validation and reenable builds (#7670)
* Fix PHP byte validation and reenable builds
* Use checkout@v3
Co-authored-by: Derek Bailey <derekbailey@google.com>
Diffstat (limited to 'php')
-rw-r--r-- | php/ByteBuffer.php | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/php/ByteBuffer.php b/php/ByteBuffer.php index 9929a7df..bb438001 100644 --- a/php/ByteBuffer.php +++ b/php/ByteBuffer.php @@ -486,7 +486,12 @@ class ByteBuffer } private static function validateValue($min, $max, $value, $type, $additional_notes = "") { - if(!($min <= $value && $value <= $max)) { + if ( + !( + ($type === "byte" && $min <= ord($value) && ord($value) <= $max) || + ($min <= $value && $value <= $max) + ) + ) { throw new \InvalidArgumentException(sprintf("bad number %s for type %s.%s", $value, $type, $additional_notes)); } } |