mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-25 08:12:40 +01:00
Fix an issue where "phutil_utf8v()" could fatal when passed an integer
Summary: See <https://discourse.phabricator-community.org/t/search-by-name-in-files-doesnt-support-number/4300>. I can't exactly reproduce the original issue, but when a query like "quack 1234" is tokenized, we end up calling "phutil_utf8v(1234)", where the argument is an integer. At least in recent versions of PHP, this fatals ("trying to access an offset of an integer"). Cast the argument first. Test Plan: Searched for "quack 1234" in Files. Before: fatal accessing offset of integer; after: correct results. Differential Revision: https://secure.phabricator.com/D21477
This commit is contained in:
parent
04e340ab0f
commit
ccf74a40dd
1 changed files with 2 additions and 0 deletions
|
@ -426,6 +426,8 @@ function phutil_utf8_is_cjk($string) {
|
||||||
* @return list A list of characters in the string.
|
* @return list A list of characters in the string.
|
||||||
*/
|
*/
|
||||||
function phutil_utf8v($string, $byte_limit = null) {
|
function phutil_utf8v($string, $byte_limit = null) {
|
||||||
|
$string = phutil_string_cast($string);
|
||||||
|
|
||||||
$res = array();
|
$res = array();
|
||||||
$len = strlen($string);
|
$len = strlen($string);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue