grapheme_extract() returns false instead of empty string when the offset is equal to the length of the haystack
未关闭
还没有人认领这个 Issue。
Bug
Extension: intl
Status: Needs Triage
- 主要语言
- C
- 星标
- 40.4k
- 派生
- 8.2k
- 平均合并
- 2 天 13 小时
- 30 天内合并 PR
- 96
描述
Description
The following code:
<?php
var_dump(grapheme_extract('', 42));
var_dump(grapheme_extract('ab', 42, offset: 2));
Resulted in this output:
bool(false)
bool(false)
But I expected this output instead:
string(0) ""
string(0) ""
Per documentation, the offset ought to be less then or equal to the length of the string (which I consider an appropriate range).
PHP Version
PHP 8.3
Operating System
No response
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先复现报告中的两个 grapheme_extract() 调用,然后在 php-src 中定位该函数的实现及相关测试。验证等于 haystack 长度的 offset 在两种情况下都返回空字符串,同时其他 offset 的行为保持不变。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- c, php
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 45/100