alexacrm / polyfill-php70
将一些PHP 7.0+特性向后移植到较低版本的PHP,与PHP7兼容
v1.11.1
2019-05-16 14:21 UTC
Requires
- php: >=5.3.3
- paragonie/random_compat: ~1.0|~2.0|~9.99
Replaces
- symfony/polyfill-php70: ~1.0
README
此组件提供了PHP 7.0之前版本中不可用的功能
intdiv
preg_replace_callback_array
error_clear_last
random_bytes
和random_int
(来自paragonie/random_compat)- 可抛出的
*Error
类 PHP_INT_MIN
SessionUpdateTimestampHandlerInterface
更多信息可以在主Polyfill README中找到。
兼容性说明
要在PHP5和PHP7之间编写可移植的代码,需要注意一些事项
- 必须在
\Exception
之前捕获\*Error
异常; - 在调用
error_clear_last()
之后,应使用isset($e['message'][0])
而不是null !== $e
来验证$e = error_get_last()
的结果。
许可
此库根据MIT许可发布。