Bug #55562 [Asn->Csd]: grapheme_substr() returns false if length parameter is to large
| From: | stas@php.net | Date: | Sun, 04 Sep 2011 18:50:40 +0000 |
| Subject: | Bug #55562 [Asn->Csd]: grapheme_substr() returns false if length parameter is to large | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-163283@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55562&edit=1
ID: 55562
Updated by: stas@php.net
Reported by: thomas at weinert dot info
Summary: grapheme_substr() returns false if length parameter
is to large
-Status: Assigned
+Status: Closed
Type: Bug
Package: I18N and L10N related
Operating System: Windows
PHP Version: 5.3.8
Assigned To: stas
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in SVN.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
fixed, thanks
Previous Comments:
------------------------------------------------------------------------
[2011-09-04 18:49:52] stas@php.net
Automatic comment from SVN on behalf of stas
Revision: http://svn.php.net/viewvc/?view=revision&revision=316113
Log: fix bug 55562 - make substr always return rest of the string if length is too long
------------------------------------------------------------------------
[2011-09-04 17:14:06] pajoye@php.net
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...
------------------------------------------------------------------------
[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