|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42107 sscanf broken when using %2$s type format parameters
Submitted: 2007-07-26 00:54 UTC Modified: 2007-07-26 15:24 UTC
From: mike at theupstairsroom dot com Assigned: jani (profile)
Status: Closed Package: Strings related
PHP Version: 5.2.3 OS: CentOS
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
41 - 21 = ?
Subscribe to this entry?

 [2007-07-26 00:54 UTC] mike at theupstairsroom dot com
Unexpected results returned when using positioned parameters in sscanf()

Reproduce code:
$test = sscanf('test string', '%2$s %1$s');

Expected result:
   [0] => 'string',
   [1] => 'test'

Actual result:
    [0] => 
    [1] => 
    [3] => test
    [2] => string


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-26 14:27 UTC]
Fix prepared. Running test now..
 [2007-07-26 15:24 UTC]
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
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Apr 13 21:01:23 2021 UTC