php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66225 strtok incorrectly parses string
Submitted: 2013-12-03 11:09 UTC Modified: 2013-12-03 12:44 UTC
From: nick dot chervyakov at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: nick dot chervyakov at gmail dot com
New email:
PHP Version: OS:

 

 [2013-12-03 11:09 UTC] nick dot chervyakov at gmail dot com
Description:
------------
strtok cuts repeatable characters which are not in the separator.

Test script:
---------------
<?php

$str = "hello melon";

echo strtok($str, 'lo') . "\n";
echo strtok('lo');


Expected result:
----------------
hel
 me

Actual result:
--------------
he
 me

// as if the first separator is 'llo'

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-12-03 12:44 UTC] mike@php.net
-Status: Open +Status: Not a bug -Operating System: windows7, ubuntu-64 +Operating System:
 [2013-12-03 12:44 UTC] mike@php.net
Quote from manual: "delimited by any character from token. "
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 12:01:28 2024 UTC