php / php/php-src

grapheme_extract() returns false instead of empty string when the offset is equal to the length of the haystack

オープン
#18,031 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Extension: intl Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、報告にある2つの grapheme_extract() 呼び出しを再現し、次に php-src 内で関数の実装と関連するテストを見つけます。haystack の長さと等しい offset が、どちらの場合も空の文字列を返すことを確認し、他の offset に対する動作は変更されないことを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, php
領域
backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。