-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
PHP 8.1以降、 mb_strwidth() が実態に即していない #57
Comments
https://www.unicode.org/Public/14.0.0/ucd/EastAsianWidth.txt をベースに単純にアップデートするとメンテナンスが現実的ではないので、Unicode仕様をそのまま参照する記述に変えた方がよさそうです。 現在の記述を踏襲して仕様を反映したときの差分diff --git a/reference/mbstring/functions/mb-strwidth.xml b/reference/mbstring/functions/mb-strwidth.xml
index 5a9b33c03..b3928927b 100644
--- a/reference/mbstring/functions/mb-strwidth.xml
+++ b/reference/mbstring/functions/mb-strwidth.xml
@@ -26,9 +26,40 @@
<para>
全角文字は次のとおりです。
<literal>U+1100</literal>-<literal>U+115F</literal>、
- <literal>U+11A3</literal>-<literal>U+11A7</literal>、
- <literal>U+11FA</literal>-<literal>U+11FF</literal>、
+ <literal>U+231A</literal>-<literal>U+231B</literal>、
<literal>U+2329</literal>-<literal>U+232A</literal>、
+ <literal>U+23E9</literal>-<literal>U+23EC</literal>、
+ <literal>U+23F0</literal>、
+ <literal>U+23F3</literal>、
+ <literal>U+25FD</literal>-<literal>U+25FE</literal>、
+ <literal>U+2614</literal>-<literal>U+2615</literal>、
+ <literal>U+2648</literal>-<literal>U+2653</literal>、
+ <literal>U+267F</literal>、
+ <literal>U+2693</literal>、
+ <literal>U+26A1</literal>、
+ <literal>U+26AA</literal>-<literal>U+26AB</literal>、
+ <literal>U+26BD</literal>-<literal>U+26BE</literal>、
+ <literal>U+26C4</literal>-<literal>U+26C5</literal>、
+ <literal>U+26CE</literal>、
+ <literal>U+26D4</literal>、
+ <literal>U+26EA</literal>、
+ <literal>U+26F2</literal>-<literal>U+26F3</literal>、
+ <literal>U+26F5</literal>、
+ <literal>U+26FA</literal>、
+ <literal>U+26FD</literal>、
+ <literal>U+2705</literal>、
+ <literal>U+270A</literal>-<literal>U+270B</literal>、
+ <literal>U+2728</literal>、
+ <literal>U+274C</literal>、
+ <literal>U+274E</literal>、
+ <literal>U+2753</literal>-<literal>U+2755</literal>、
+ <literal>U+2757</literal>、
+ <literal>U+2795</literal>-<literal>U+2797</literal>、
+ <literal>U+27B0</literal>、
+ <literal>U+27BF</literal>、
+ <literal>U+2B1B</literal>-<literal>U+2B1C</literal>、
+ <literal>U+2B50</literal>、
+ <literal>U+2B55</literal>、
<literal>U+2E80</literal>-<literal>U+2E99</literal>、
<literal>U+2E9B</literal>-<literal>U+2EF3</literal>、
<literal>U+2F00</literal>-<literal>U+2FD5</literal>、
@@ -36,34 +67,109 @@
<literal>U+3000</literal>-<literal>U+303E</literal>、
<literal>U+3041</literal>-<literal>U+3096</literal>、
<literal>U+3099</literal>-<literal>U+30FF</literal>、
- <literal>U+3105</literal>-<literal>U+312D</literal>、
+ <literal>U+3105</literal>-<literal>U+312F</literal>、
<literal>U+3131</literal>-<literal>U+318E</literal>、
- <literal>U+3190</literal>-<literal>U+31BA</literal>、
+ <literal>U+3190</literal>-<literal>U+31BF</literal>、
<literal>U+31C0</literal>-<literal>U+31E3</literal>、
- <literal>U+31F0</literal>-<literal>U+321E</literal>、
- <literal>U+3220</literal>-<literal>U+3247</literal>、
- <literal>U+3250</literal>-<literal>U+32FE</literal>、
- <literal>U+3300</literal>-<literal>U+4DBF</literal>、
- <literal>U+4E00</literal>-<literal>U+A48C</literal>、
+ <literal>U+31F0</literal>-<literal>U+31FF</literal>、
+ <literal>U+3200</literal>-<literal>U+321E</literal>、
+ <literal>U+3220</literal>-<literal>U+3229</literal>、
+ <literal>U+322A</literal>-<literal>U+3247</literal>、
+ <literal>U+3250</literal>-<literal>U+A48C</literal>、
<literal>U+A490</literal>-<literal>U+A4C6</literal>、
<literal>U+A960</literal>-<literal>U+A97C</literal>、
<literal>U+AC00</literal>-<literal>U+D7A3</literal>、
- <literal>U+D7B0</literal>-<literal>U+D7C6</literal>、
- <literal>U+D7CB</literal>-<literal>U+D7FB</literal>、
<literal>U+F900</literal>-<literal>U+FAFF</literal>、
<literal>U+FE10</literal>-<literal>U+FE19</literal>、
- <literal>U+FE30</literal>-<literal>U+FE52</literal>、
- <literal>U+FE54</literal>-<literal>U+FE66</literal>、
- <literal>U+FE68</literal>-<literal>U+FE6B</literal>、
- <literal>U+FF01</literal>-<literal>U+FF60</literal>、
- <literal>U+FFE0</literal>-<literal>U+FFE6</literal>、
- <literal>U+1B000</literal>-<literal>U+1B001</literal>、
+ <literal>U+FE30</literal>-<literal>U+FF60</literal>、
+ <literal>U+FFE0</literal>-<literal>U+FFE1</literal>、
+ <literal>U+FFE2</literal>、
+ <literal>U+FFE3</literal>、
+ <literal>U+FFE4</literal>、
+ <literal>U+FFE5</literal>-<literal>U+FFE6</literal>、
+ <literal>U+16FE0</literal>-<literal>U+16FE1</literal>、
+ <literal>U+16FE2</literal>、
+ <literal>U+16FE3</literal>、
+ <literal>U+16FE4</literal>、
+ <literal>U+16FF0</literal>-<literal>U+16FF1</literal>、
+ <literal>U+17000</literal>-<literal>U+187F7</literal>、
+ <literal>U+18800</literal>-<literal>U+18AFF</literal>、
+ <literal>U+18B00</literal>-<literal>U+18CD5</literal>、
+ <literal>U+18D00</literal>-<literal>U+18D08</literal>、
+ <literal>U+1AFF0</literal>-<literal>U+1AFF3</literal>、
+ <literal>U+1AFF5</literal>-<literal>U+1AFFB</literal>、
+ <literal>U+1AFFD</literal>-<literal>U+1AFFE</literal>、
+ <literal>U+1B000</literal>-<literal>U+1B0FF</literal>、
+ <literal>U+1B100</literal>-<literal>U+1B122</literal>、
+ <literal>U+1B150</literal>-<literal>U+1B152</literal>、
+ <literal>U+1B164</literal>-<literal>U+1B167</literal>、
+ <literal>U+1B170</literal>-<literal>U+1B2FB</literal>、
+ <literal>U+1F004</literal>、
+ <literal>U+1F0CF</literal>、
+ <literal>U+1F18E</literal>、
+ <literal>U+1F191</literal>-<literal>U+1F19A</literal>、
<literal>U+1F200</literal>-<literal>U+1F202</literal>、
- <literal>U+1F210</literal>-<literal>U+1F23A</literal>、
+ <literal>U+1F210</literal>-<literal>U+1F23B</literal>、
<literal>U+1F240</literal>-<literal>U+1F248</literal>、
<literal>U+1F250</literal>-<literal>U+1F251</literal>、
- <literal>U+20000</literal>-<literal>U+2FFFD</literal>、
- <literal>U+30000</literal>-<literal>U+3FFFD</literal>。
+ <literal>U+1F260</literal>-<literal>U+1F265</literal>、
+ <literal>U+1F300</literal>-<literal>U+1F320</literal>、
+ <literal>U+1F32D</literal>-<literal>U+1F335</literal>、
+ <literal>U+1F337</literal>-<literal>U+1F37C</literal>、
+ <literal>U+1F37E</literal>-<literal>U+1F393</literal>、
+ <literal>U+1F3A0</literal>-<literal>U+1F3CA</literal>、
+ <literal>U+1F3CF</literal>-<literal>U+1F3D3</literal>、
+ <literal>U+1F3E0</literal>-<literal>U+1F3F0</literal>、
+ <literal>U+1F3F4</literal>、
+ <literal>U+1F3F8</literal>-<literal>U+1F3FA</literal>、
+ <literal>U+1F3FB</literal>-<literal>U+1F3FF</literal>、
+ <literal>U+1F400</literal>-<literal>U+1F43E</literal>、
+ <literal>U+1F440</literal>、
+ <literal>U+1F442</literal>-<literal>U+1F4FC</literal>、
+ <literal>U+1F4FF</literal>-<literal>U+1F53D</literal>、
+ <literal>U+1F54B</literal>-<literal>U+1F54E</literal>、
+ <literal>U+1F550</literal>-<literal>U+1F567</literal>、
+ <literal>U+1F57A</literal>、
+ <literal>U+1F595</literal>-<literal>U+1F596</literal>、
+ <literal>U+1F5A4</literal>、
+ <literal>U+1F5FB</literal>-<literal>U+1F5FF</literal>、
+ <literal>U+1F600</literal>-<literal>U+1F64F</literal>、
+ <literal>U+1F680</literal>-<literal>U+1F6C5</literal>、
+ <literal>U+1F6CC</literal>、
+ <literal>U+1F6D0</literal>-<literal>U+1F6D2</literal>、
+ <literal>U+1F6D5</literal>-<literal>U+1F6D7</literal>、
+ <literal>U+1F6DD</literal>-<literal>U+1F6DF</literal>、
+ <literal>U+1F6EB</literal>-<literal>U+1F6EC</literal>、
+ <literal>U+1F6F4</literal>-<literal>U+1F6FC</literal>、
+ <literal>U+1F7E0</literal>-<literal>U+1F7EB</literal>、
+ <literal>U+1F7F0</literal>、
+ <literal>U+1F90C</literal>-<literal>U+1F93A</literal>、
+ <literal>U+1F93C</literal>-<literal>U+1F945</literal>、
+ <literal>U+1F947</literal>-<literal>U+1F9FF</literal>、
+ <literal>U+1FA70</literal>-<literal>U+1FA74</literal>、
+ <literal>U+1FA78</literal>-<literal>U+1FA7C</literal>、
+ <literal>U+1FA80</literal>-<literal>U+1FA86</literal>、
+ <literal>U+1FA90</literal>-<literal>U+1FAAC</literal>、
+ <literal>U+1FAB0</literal>-<literal>U+1FABA</literal>、
+ <literal>U+1FAC0</literal>-<literal>U+1FAC5</literal>、
+ <literal>U+1FAD0</literal>-<literal>U+1FAD9</literal>、
+ <literal>U+1FAE0</literal>-<literal>U+1FAE7</literal>、
+ <literal>U+1FAF0</literal>-<literal>U+1FAF6</literal>、
+ <literal>U+20000</literal>-<literal>U+2A6DF</literal>、
+ <literal>U+2A6E0</literal>-<literal>U+2A6FF</literal>、
+ <literal>U+2A700</literal>-<literal>U+2B738</literal>、
+ <literal>U+2B739</literal>-<literal>U+2B73F</literal>、
+ <literal>U+2B740</literal>-<literal>U+2B81D</literal>、
+ <literal>U+2B81E</literal>-<literal>U+2B81F</literal>、
+ <literal>U+2B820</literal>-<literal>U+2CEA1</literal>、
+ <literal>U+2CEA2</literal>-<literal>U+2CEAF</literal>、
+ <literal>U+2CEB0</literal>-<literal>U+2EBE0</literal>、
+ <literal>U+2EBE1</literal>-<literal>U+2F7FF</literal>、
+ <literal>U+2F800</literal>-<literal>U+2FA1D</literal>、
+ <literal>U+2FA1E</literal>-<literal>U+2FA1F</literal>、
+ <literal>U+2FA20</literal>-<literal>U+2FFFD</literal>、
+ <literal>U+30000</literal>-<literal>U+3134A</literal>、
+ <literal>U+3134B</literal>-<literal>U+3FFFD</literal> 。
他のすべての文字は半角の文字です。
</para>
</refsect1> |
まずは英語版を追従させるべきかと。
上記については、8.0 -> 8.1 の migration guide に追記すれば済むと思われます。 |
上記は、 |
[memo] https://www.php.net/manual/en/migration81.other-changes.php に書くべき案件。 |
refs php/php-src@d8c785b
文字幅に関する仕様はPHP: mb_strwidth - Manualで説明されている通りUnicodeのTR-11 EAST ASIAN WIDTHに準拠していますがeaw_table.hは2011年から更新されておらず、PHP 8.1リリース前のmbstringのオーバーホールによってUnicode 14.0に追従しました。
その際、てきめんさん @youkidearitai が指摘するように、2011年以降に追加されたEAWプロパティが
F
かW
の文字に関する計算が変わってしまっています。PHP: mb_strwidth - Manual に関して、以下の対応が必要になりそうです。
The text was updated successfully, but these errors were encountered: