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