fix(wms): do not escape slashes in JSON serialization for signature compatibility with Node WMS

This commit is contained in:
liufumingren 2026-08-15 19:11:58 +08:00
parent c00708f58c
commit 2330b6003f

View File

@ -185,7 +185,7 @@ class WmsSign
if (is_object($data)) {
// 非普通对象(如 DateTime 等)→ JSON.stringify
if (!$this->isPlainObject($data)) {
return json_encode($data, JSON_UNESCAPED_UNICODE);
return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
// 普通对象 → 提取属性,按 key 排序后序列化为 {...} 格式
$props = get_object_vars($data);
@ -218,7 +218,7 @@ class WmsSign
}
// 兜底
return json_encode($data, JSON_UNESCAPED_UNICODE);
return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
/**
@ -229,7 +229,7 @@ class WmsSign
*/
private function jsonEncodeString($str)
{
return json_encode($str, JSON_UNESCAPED_UNICODE);
return json_encode($str, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
}
/**