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
 [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: Thu Feb 29 16:01:38 2024 UTC