File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / standard / tests / strings / bug21730.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:04 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

--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)
}

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>