php.net |  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
 [2007-07-26 00:54 UTC] mike at theupstairsroom dot com
Description:
------------
Unexpected results returned when using positioned parameters in sscanf()

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

Expected result:
----------------
array(
   [0] => 'string',
   [1] => 'test'
)

Actual result:
--------------
Array
(
    [0] => 
    [1] => 
    [3] => test
    [2] => string
)

Patches

Pull Requests

History

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


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC