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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
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

Pull Requests

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: Mon Dec 30 14:01:28 2024 UTC