1--TEST-- 2Bug #42107 (sscanf() broken when using %2$s type format parameters) 3--FILE-- 4<?php 5 6var_dump(sscanf('one two', '%1$s %2$s')); 7var_dump(sscanf('one two', '%2$s %1$s')); 8echo "--\n"; 9sscanf('one two', '%1$s %2$s', $foo, $bar); 10var_dump($foo, $bar); 11sscanf('one two', '%2$s %1$s', $foo, $bar); 12var_dump($foo, $bar); 13echo "--\n"; 14var_dump(sscanf('one two', '%1$d %2$d')); 15var_dump(sscanf('one two', '%1$d')); 16echo "Done\n"; 17?> 18--EXPECTF-- 19array(2) { 20 [0]=> 21 string(3) "one" 22 [1]=> 23 string(3) "two" 24} 25array(2) { 26 [0]=> 27 string(3) "two" 28 [1]=> 29 string(3) "one" 30} 31-- 32string(3) "one" 33string(3) "two" 34string(3) "two" 35string(3) "one" 36-- 37array(2) { 38 [0]=> 39 NULL 40 [1]=> 41 NULL 42} 43array(1) { 44 [0]=> 45 NULL 46} 47Done 48