|  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: mike at theupstairsroom dot com
New email:
PHP Version: OS:


 [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: Fri Apr 16 13:01:40 2021 UTC