summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoriyoshi Koizumi <moriyoshi@php.net>2003-01-18 18:59:27 +0000
committerMoriyoshi Koizumi <moriyoshi@php.net>2003-01-18 18:59:27 +0000
commit2aa7bf8d8b2054a5bdb25fe737cbf05c273dd8ac (patch)
tree1ee986b56d29a50faea600983d18d51a3ea01af1
parenta3daf3bbe8be19e383fe81f170cb146faa694847 (diff)
downloadphp-git-2aa7bf8d8b2054a5bdb25fe737cbf05c273dd8ac.tar.gz
Added test case for bug #21730
-rw-r--r--ext/standard/tests/strings/bug21730.phpt35
1 files changed, 35 insertions, 0 deletions
diff --git a/ext/standard/tests/strings/bug21730.phpt b/ext/standard/tests/strings/bug21730.phpt
new file mode 100644
index 0000000000..192aedf347
--- /dev/null
+++ b/ext/standard/tests/strings/bug21730.phpt
@@ -0,0 +1,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);
+?>
+--EXPECTS--
+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)
+}