fix(wms): do not escape slashes in JSON serialization for signature compatibility with Node WMS
This commit is contained in:
parent
c00708f58c
commit
2330b6003f
@ -185,7 +185,7 @@ class WmsSign
|
|||||||
if (is_object($data)) {
|
if (is_object($data)) {
|
||||||
// 非普通对象(如 DateTime 等)→ JSON.stringify
|
// 非普通对象(如 DateTime 等)→ JSON.stringify
|
||||||
if (!$this->isPlainObject($data)) {
|
if (!$this->isPlainObject($data)) {
|
||||||
return json_encode($data, JSON_UNESCAPED_UNICODE);
|
return json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
}
|
}
|
||||||
// 普通对象 → 提取属性,按 key 排序后序列化为 {...} 格式
|
// 普通对象 → 提取属性,按 key 排序后序列化为 {...} 格式
|
||||||
$props = get_object_vars($data);
|
$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)
|
private function jsonEncodeString($str)
|
||||||
{
|
{
|
||||||
return json_encode($str, JSON_UNESCAPED_UNICODE);
|
return json_encode($str, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user