From 1f5fc14cc6f54dc65f9d81ebf6e8dbf0ff64f1df Mon Sep 17 00:00:00 2001 From: sunhao Date: Fri, 19 Jan 2024 16:00:21 +0800 Subject: [PATCH] * zin: support to accept null value in setData. --- lib/zin/core/wg.func.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/zin/core/wg.func.php b/lib/zin/core/wg.func.php index 7d0d36c829..ebd4049e3d 100644 --- a/lib/zin/core/wg.func.php +++ b/lib/zin/core/wg.func.php @@ -109,8 +109,9 @@ function setTag(string $id): directive * @param mixed $value * @return directive */ -function setData(string|array $name, mixed $value = null): directive +function setData(null|string|array $name, mixed $value = null): directive { + if($name === null) return set(null); $map = is_array($name) ? $name : array($name => $value); $attrs = array(); foreach($map as $key => $value)