summaryrefslogtreecommitdiff
path: root/php
diff options
context:
space:
mode:
Diffstat (limited to 'php')
-rw-r--r--php/ByteBuffer.php7
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));
}
}