hershel-theodore-layton/json-post-deserialize 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hershel-theodore-layton/json-post-deserialize

最新稳定版本:v0.2.1

Composer 安装命令:

composer require hershel-theodore-layton/json-post-deserialize

包简介

A fast to run verification to run after json_decode()

README 文档

README

A fast to run verification to run after json_decode()

Why?

\json_decode() can parse invalid JSON. If you want to store the JSON and expect to be able to parse it in the future, you should check it is not invalid JSON first. Future versions of hhvm might not parse invalid JSON the same way. Other programming environments, like Python, Go, or JavaScript certainly don't.

How?

After calling \json_decode_with_error(), you should check the $error variable. If this is null, you might still have parsed invalid JSON. \HTL\JsonCheck\quick_reject(string $json) will let you know that this happened. quick_reject() does not return an error for many invalid JSON documents, but it does return an error for every invalid JSON document that gets past \json_decode_with_error().

Why do this in Hack?

There is no function accessible to Hack that can validate a JSON document. If you want to call a real JSON parser, you'd need to call an external process. The overhead of copying the json string to the external process outweighs the cost of the hot loop in quick_reject().

统计信息

  • 总下载量: 127
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: Hack

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固