summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/bug21730.phpt
blob: 8d40e204ce1096caed0638f7d994ad8795c1ca12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--TEST--
Bug #21730 (*scanf "%n" conversion flag gives string instead of integer)
--FILE--
<?php
$foo = "ABC = DEF";
$fmt = "%s = %s %n";
$res_a = array();

/* $res_a[2] is supposed to be a integer value that
 * represents the number of characters consumed so far
 */
sscanf($foo, $fmt, $res_a[0], $res_a[1], $res_a[2]);

$res_b = sscanf($foo, $fmt);

var_dump($res_a);
var_dump($res_b);
?>
--EXPECT--
array(3) {
  [0]=>
  string(3) "ABC"
  [1]=>
  string(3) "DEF"
  [2]=>
  int(9)
}
array(3) {
  [0]=>
  string(3) "ABC"
  [1]=>
  string(3) "DEF"
  [2]=>
  int(9)
}