From 97507efb23daf2c3f1a15a7dfc24a6d0b32c3b9b Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Wed, 5 Jul 2023 15:22:45 +0300 Subject: [PATCH] Adding val_blob(..) checker --- src/data_utils.inc.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/data_utils.inc.php b/src/data_utils.inc.php index a28a514..c494dad 100644 --- a/src/data_utils.inc.php +++ b/src/data_utils.inc.php @@ -182,3 +182,13 @@ function val_enum($enum, $val, $check_enum_validity = true) return $val; } +function val_blob($val) +{ + if(is_null($val)) + return $val; + + if(!is_string($val)) + throw new Exception("Bad item, not a blob string(" . serialize($val) . ")"); + + return $val; +}