]> granicus.if.org Git - php/blob
0af8f9ed14
[php] /
1 --TEST--
2 Test sscanf() function : error conditions
3 --FILE--
4 <?php
5
6 /* Prototype  : mixed sscanf  ( string $str  , string $format  [, mixed &$...  ] )
7  * Description: Parses input from a string according to a format
8  * Source code: ext/standard/string.c
9 */
10 echo "*** Testing sscanf() : error conditions ***\n";
11
12 $str = "Hello World";
13 $format = "%s %s";
14
15 echo "\n-- Testing sscanf() function with more than expected no. of arguments --\n";
16
17 try {
18     sscanf($str, $format, $str1, $str2, $extra_str);
19 } catch (ValueError $exception) {
20     echo $exception->getMessage() . "\n";
21 }
22 ?>
23 --EXPECT--
24 *** Testing sscanf() : error conditions ***
25
26 -- Testing sscanf() function with more than expected no. of arguments --
27 Variable is not assigned by any conversion specifiers