Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json数据空对象异常处理 #671

Open
LonelySally opened this issue Feb 17, 2025 · 0 comments
Open

json数据空对象异常处理 #671

LonelySally opened this issue Feb 17, 2025 · 0 comments

Comments

@LonelySally
Copy link

LonelySally commented Feb 17, 2025

当数据库中json存储内容包含空对象时,转义时会被强制转换成数据,与预期不符.

//存储数据
{"A":{},"B":[]}

//得到结果
 {#327
  +"A": []
  +"B": []
}

//预期得到
 {#327
  +"A": {#329}
  +"B": []
}

问题发上在ModelRelationQuery.php

 $jsonData = json_decode($result[$name], true);

同理framework的入参处理也存在该问题.当入参为空对象时也成为了空数据,需要手动处理得到如期结果.

json_decode(file_get_contents('php://input'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant