Edit report at https://bugs.php.net/bug.php?id=55562&edit=1

 ID:                 55562
 Updated by:         paj...@php.net
 Reported by:        thomas at weinert dot info
 Summary:            grapheme_substr() returns false if length parameter
                     is to large
-Status:             Open
+Status:             Assigned
 Type:               Bug
 Package:            I18N and L10N related
 Operating System:   Windows
 PHP Version:        5.3.8
-Assigned To:        
+Assigned To:        stas
 Block user comment: N
 Private report:     N

 New Comment:

I can confirm this bug, but I'm not sure how to fix it correctly. If I fix the 
related logic, the substr tests then partially fail. This function is cryptic 
and 
should really deserve some comments about what means each variable name and 
what 
are their goals...


Previous Comments:
------------------------------------------------------------------------
[2011-09-01 13:19:32] thomas at weinert dot info

Description:
------------
If the input string contains multibyte characters and the length argument is 
greater then the possible maximum length of the result the function returns 
false.

Test script:
---------------
<?php
var_dump(
  grapheme_substr('FOK', 1, 20), // expected: OK
  grapheme_substr('한국어', 1, 20) //expected: 국어
);

Expected result:
----------------
string(2) "OK"
string(6) "국어"

Actual result:
--------------
string(2) "OK"
bool(false)


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55562&edit=1

Reply via email to