#39032 [Opn->Csd]: strcspn stops on null character
| From: | tony2001@php.net | Date: | Wed, 04 Oct 2006 11:15:25 +0000 |
| Subject: | #39032 [Opn->Csd]: strcspn stops on null character | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-103070@lists.php.net to get a copy of this message | ||
ID: 39032
Updated by: tony2001@php.net
Reported By: tstarling at wikimedia dot org
-Status: Open
+Status: Closed
Bug Type: Strings related
Operating System: Linux
PHP Version: 5.1.6
New Comment:
This bug has been fixed in CVS.
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/.
Thank you for the report, and for helping us make PHP better.
Fixed in 5.2 and HEAD.
Previous Comments:
------------------------------------------------------------------------
[2006-10-04 08:37:51] tstarling at wikimedia dot org
Description:
------------
strcspn() incorrectly stops on null characters, as if the function was
implemented with null-terminated strings. Confirmed on PHP
5.1.6-pl4-gentoo (cli), PHP 5.1.4 Windows NT mod_php, PHP 5.1.4 FC4
cli.
Reproduce code:
---------------
print strcspn(chr(0),"x").", ".strcspn(chr(1),"x")."\n"
Expected result:
----------------
1, 1
Actual result:
--------------
0, 1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39032&edit=1