+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - octal formats with octal values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different octal formats and octal values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : octal formats with octal values ***\n";
-
-// defining array of octal formats
-$formats = array(
- "%o",
- "%+o %-o %O",
- "%lo %Lo, %4o %-4o",
- "%10.4o %-10.4o %04o %04.4o",
- "%'#2o %'2o %'$2o %'_2o",
- "%o %o %o %o",
- "%% %%o %10 o%",
- '%3$o %4$o %1$o %2$o'
-);
-
-// Arrays of octal values for the format defined in $format.
-// Each sub array contains octal values which correspond to each format string in $format
-$args_array = array(
- array(00),
- array(-01, 01, +022),
- array(-020000000000, 020000000000, 017777777777, -017777777777),
- array(0123456, 01234567, -01234567, 01234567),
- array(0111, 02222, -0333333, -044444444),
- array(0x123b, 0xfAb, 0123, 012),
- array(01234, 0567, -01234, 02345),
- array(03, 04, 01, 02)
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation11.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different octal formats from the above $formats array
-// and with octal values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : octal formats with octal values ***
-
--- Iteration 1 --
-0
--- Iteration 2 --
-37777777777 1
--- Iteration 3 --
-20000000000 o, 17777777777 20000000001
--- Iteration 4 --
- 37776543211 0000
--- Iteration 5 --
-111 2222 37777444445 37733333334
--- Iteration 6 --
-11073 7653 123 12
--- Iteration 7 --
-% %o o
--- Iteration 8 --
-1 2 3 4
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - octal formats with octal values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different octal formats and octal values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : octal formats with octal values ***\n";
-
-// defining array of octal formats
-$formats = array(
- "%o",
- "%+o %-o %O",
- "%lo %Lo, %4o %-4o",
- "%10.4o %-10.4o %04o %04.4o",
- "%'#2o %'2o %'$2o %'_2o",
- "%o %o %o %o",
- "%% %%o %10 o%",
- '%3$o %4$o %1$o %2$o'
-);
-
-// Arrays of octal values for the format defined in $format.
-// Each sub array contains octal values which correspond to each format string in $format
-$args_array = array(
- array(00),
- array(-01, 01, +022),
- array(-020000000000, 020000000000, 017777777777, -017777777777),
- array(0123456, 01234567, -01234567, 01234567),
- array(0111, 02222, -0333333, -044444444),
- array(0x123b, 0xfAb, 0123, 012),
- array(01234, 0567, -01234, 02345),
- array(03, 04, 01, 02)
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation11_64bit.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different octal formats from the above $formats array
-// and with octal values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : octal formats with octal values ***
-
--- Iteration 1 --
-0
--- Iteration 2 --
-1777777777777777777777 1
--- Iteration 3 --
-1777777777760000000000 o, 17777777777 1777777777760000000001
--- Iteration 4 --
- 1777777777777776543211 0000
--- Iteration 5 --
-111 2222 1777777777777777444445 1777777777777733333334
--- Iteration 6 --
-11073 7653 123 12
--- Iteration 7 --
-% %o o
--- Iteration 8 --
-1 2 3 4
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - octal formats with non-octal values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different octal formats and non-octal values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : octal formats and non-octal values ***\n";
-
-// defining array of octal formats
-$formats =
- '%o %+o %-o
- %lo %Lo %4o %-4o
- %10.4o %-10.4o %.4o
- %\'#2o %\'2o %\'$2o %\'_2o
- %3$o %4$o %1$o %2$o';
-
-// Arrays of non octal values for the format defined in $format.
-// Each sub array contains non octal values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e12, 22e+12,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation12.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different octal formats from the above $format array
-// and with non-octal values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : octal formats and non-octal values ***
-
--- Iteration 1 --
-2 0 12
- 361100 o 37777775456 2322
-
- 30071 14 37777777764 37777416700
- 12 361100 2 0
--- Iteration 2 --
-2 37777777776 2
- 361100 o 37720715133 57062645
-
- 57060664 4475347 37721631371 37720717336
- 2 361100 2 37777777776
--- Iteration 3 --
-0 0 0
- 173 o 37777777605 173
-
- 2322 0 $0 _0
- 0 173 0 0
--- Iteration 4 --
-1 1 1
- 1 o 1 1
-
- #1 1 $1 _1
- 1 1 1 1
--- Iteration 5 --
-1 1 0
- 1 o 0 1
-
- #0 1 $1 _0
- 0 1 1 1
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - octal formats with non-octal values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different octal formats and non-octal values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : octal formats and non-octal values ***\n";
-
-// defining array of octal formats
-$formats =
- '%o %+o %-o
- %lo %Lo %4o %-4o
- %10.4o %-10.4o %.4o
- %\'#2o %\'2o %\'$2o %\'_2o
- %3$o %4$o %1$o %2$o';
-
-// Arrays of non octal values for the format defined in $format.
-// Each sub array contains non octal values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e12, 22e+12,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation12_64bit.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different octal formats from the above $format array
-// and with non-octal values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : octal formats and non-octal values ***
-
--- Iteration 1 --
-2 0 12
- 361100 o 1777777777777777775456 2322
-
- 30071 14 1777777777777777777764 1777777777777777416700
- 12 361100 2 0
--- Iteration 2 --
-2 1777777777777777777776 2
- 361100 o 1777777777777720715133 57062645
-
- 57060664 4475347 1777777777777721631371 1777777777777720717336
- 2 361100 2 1777777777777777777776
--- Iteration 3 --
-0 0 0
- 173 o 1777777777777777777605 173
-
- 2322 0 $0 _0
- 0 173 0 0
--- Iteration 4 --
-1 1 1
- 1 o 1 1
-
- #1 1 $1 _1
- 1 1 1 1
--- Iteration 5 --
-1 1 0
- 1 o 0 1
-
- #0 1 $1 _0
- 0 1 1 1
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - hexa formats with hexa values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different hexa formats and hexa values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : hexa formats with hexa values ***\n";
-
-// defining array of different hexa formats
-$formats = array(
- "%x",
- "%+x %-x %X",
- "%lx %Lx, %4x %-4x",
- "%10.4x %-10.4x %04x %04.4x",
- "%'#2x %'2x %'$2x %'_2x",
- "%x %x %x %x",
- "% %%x x%",
- '%3$x %4$x %1$x %2$x'
-);
-
-// Arrays of hexa values for the format defined in $format.
-// Each sub array contains hexa values which correspond to each format string in $format
-$args_array = array(
- array(0x0),
- array(-0x1, 0x1, +0x22),
- array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
- array(123456, 12345678, -1234567, 1234567),
- array(1, 0x2222, 0333333, -0x44444444),
- array(0x123b, 0xfAb, "0xaxz", 012),
- array(0x1234, 0x34, 0x2ff),
- array(0x3, 0x4, 0x1, 0x2)
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation13.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different char octal from the above $format array
-// and with octal values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : hexa formats with hexa values ***
-
--- Iteration 1 --
-0
--- Iteration 2 --
-ffffffff 1 22
--- Iteration 3 --
-7fffffff x, 7000000 80000000
--- Iteration 4 --
- ffed2979 0000
--- Iteration 5 --
-#1 2222 1b6db bbbbbbbc
--- Iteration 6 --
-123b fab 0 a
--- Iteration 7 --
-%34 x
--- Iteration 8 --
-1 2 3 4
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - hexa formats with hexa values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different hexa formats and hexa values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : hexa formats with hexa values ***\n";
-
-// defining array of different hexa formats
-$formats = array(
- "%x",
- "%+x %-x %X",
- "%lx %Lx, %4x %-4x",
- "%10.4x %-10.4x %04x %04.4x",
- "%'#2x %'2x %'$2x %'_2x",
- "%x %x %x %x",
- "% %%x x%",
- '%3$x %4$x %1$x %2$x'
-);
-
-// Arrays of hexa values for the format defined in $format.
-// Each sub array contains hexa values which correspond to each format string in $format
-$args_array = array(
- array(0x0),
- array(-0x1, 0x1, +0x22),
- array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
- array(123456, 12345678, -1234567, 1234567),
- array(1, 0x2222, 0333333, -0x44444444),
- array(0x123b, 0xfAb, "0xaxz", 012),
- array(0x1234, 0x34, 0x2ff),
- array(0x3, 0x4, 0x1, 0x2)
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation13_64bit.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different char octal from the above $format array
-// and with octal values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : hexa formats with hexa values ***
-
--- Iteration 1 --
-0
--- Iteration 2 --
-ffffffffffffffff 1 22
--- Iteration 3 --
-7fffffff x, 7000000 ffffffff80000000
--- Iteration 4 --
- ffffffffffed2979 0000
--- Iteration 5 --
-#1 2222 1b6db ffffffffbbbbbbbc
--- Iteration 6 --
-123b fab 0 a
--- Iteration 7 --
-%34 x
--- Iteration 8 --
-1 2 3 4
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - hexa formats with non-hexa values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different hexa formats and non-hexa values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : hexa formats and non-hexa values ***\n";
-
-// defining array of different hexa formats
-$formats =
- '%x %+x %-x
- %lx %Lx %4x %-4x
- %10.4x %-10.4x %.4x
- %\'#2x %\'2x %\'$2x %\'_2x
- %3$x %4$x %1$x %2$x';
-
-// Arrays of non hexa values for the format defined in $format.
-// Each sub array contains non hexa values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e12, 22e+12,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation14.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different hexa formats from the above $format array
-// and with non-hexa values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : hexa formats and non-hexa values ***
-
--- Iteration 1 --
-2 0 a
- 1e240 x fffffb2e 4d2
-
- 3039 c fffffff4 fffe1dc0
- a 1e240 2 0
--- Iteration 2 --
-2 fffffffe 2
- 1e240 x ff439a5b bc65a5
-
- bc61b4 127ae7 ff4732f9 ff439ede
- 2 1e240 2 fffffffe
--- Iteration 3 --
-0 0 0
- 7b x ffffff85 7b
-
- 4d2 0 $0 _0
- 0 7b 0 0
--- Iteration 4 --
-1 1 1
- 1 x 1 1
-
- #1 1 $1 _1
- 1 1 1 1
--- Iteration 5 --
-1 1 0
- 1 x 0 1
-
- #0 1 $1 _0
- 0 1 1 1
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - hexa formats with non-hexa values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different hexa formats and non-hexa values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : hexa formats and non-hexa values ***\n";
-
-// defining array of different hexa formats
-$formats =
- '%x %+x %-x
- %lx %Lx %4x %-4x
- %10.4x %-10.4x %.4x
- %\'#2x %\'2x %\'$2x %\'_2x
- %3$x %4$x %1$x %2$x';
-
-// Arrays of non hexa values for the format defined in $format.
-// Each sub array contains non hexa values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e12, 22e+12,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation14_64bit.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different hexa formats from the above $format array
-// and with non-hexa values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : hexa formats and non-hexa values ***
-
--- Iteration 1 --
-2 0 a
- 1e240 x fffffffffffffb2e 4d2
-
- 3039 c fffffffffffffff4 fffffffffffe1dc0
- a 1e240 2 0
--- Iteration 2 --
-2 fffffffffffffffe 2
- 1e240 x ffffffffff439a5b bc65a5
-
- bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede
- 2 1e240 2 fffffffffffffffe
--- Iteration 3 --
-0 0 0
- 7b x ffffffffffffff85 7b
-
- 4d2 0 $0 _0
- 0 7b 0 0
--- Iteration 4 --
-1 1 1
- 1 x 1 1
-
- #1 1 $1 _1
- 1 1 1 1
--- Iteration 5 --
-1 1 0
- 1 x 0 1
-
- #0 1 $1 _0
- 0 1 1 1
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - unsigned formats with unsigned values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different unsigned formats and unsigned values
- * are passed to the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : unsigned formats and unsigned values ***\n";
-
-// defining array of unsigned formats
-$formats = array(
- '%u %+u %-u',
- '%lu %Lu %4u %-4u',
- '%10.4u %-10.4u %.4u',
- '%\'#2u %\'2u %\'$2u %\'_2u',
- '%3$u %4$u %1$u %2$u'
-);
-
-// Arrays of unsigned values for the format defined in $format.
-// Each sub array contains unsigned values which correspond to each format string in $format
-$args_array = array(
- array(1234567, 01234567, 0 ),
- array(12345678900, 12345678900, 1234, 12345),
- array("1234000", 10.1234567e10, 1.2e2),
- array(1, 0, 00, "10_"),
- array(3, 4, 1, 2)
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation15.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different unsigned formats from the above $format array
-// and with signed and other types of values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : unsigned formats and unsigned values ***
-
--- Iteration 1 --
-1234567 342391 0
--- Iteration 2 --
-3755744308 u 1234 12345
--- Iteration 3 --
- 1234000 2450319192 120
--- Iteration 4 --
-#1 0 $0 10
--- Iteration 5 --
-1 2 3 4
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - unsigned formats with unsigned values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different unsigned formats and unsigned values
- * are passed to the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : unsigned formats and unsigned values ***\n";
-
-// defining array of unsigned formats
-$formats = array(
- '%u %+u %-u',
- '%lu %Lu %4u %-4u',
- '%10.4u %-10.4u %.4u',
- '%\'#2u %\'2u %\'$2u %\'_2u',
- '%3$u %4$u %1$u %2$u'
-);
-
-// Arrays of unsigned values for the format defined in $format.
-// Each sub array contains unsigned values which correspond to each format string in $format
-$args_array = array(
- array(1234567, 01234567, 0 ),
- array(12345678900, 12345678900, 1234, 12345),
- array("1234000", 10.1234567e10, 1.2e2),
- array(1, 0, 00, "10_"),
- array(3, 4, 1, 2)
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation15_64bit.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different unsigned formats from the above $format array
-// and with signed and other types of values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : unsigned formats and unsigned values ***
-
--- Iteration 1 --
-1234567 342391 0
--- Iteration 2 --
-12345678900 u 1234 12345
--- Iteration 3 --
- 1234000 101234567000 120
--- Iteration 4 --
-#1 0 $0 10
--- Iteration 5 --
-1 2 3 4
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - unsigned formats with signed and other types of values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different unsigned formats and signed values and other types of values
- * are passed to the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : unsigned formats and signed & other types of values ***\n";
-
-// defining array of unsigned formats
-$formats =
- '%u %+u %-u
- %lu %Lu %4u %-4u
- %10.4u %-10.4u %.4u
- %\'#2u %\'2u %\'$2u %\'_2u
- %3$u %4$u %1$u %2$u';
-
-// Arrays of signed and other type of values for the format defined in $format.
-// Each sub array contains signed values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(+2.2, +.2, +10.2,
- +123456.234, +123456.234, +1234.6789,
- +2e10, +2e12, +22e+12,
- +12345.780, +12.000000011111, -12.00000111111, -123456.234,
- +3.33, +4.44, +1.11,-2.22 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation16.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different unsigned formats from the above $format array
-// and with signed and other types of values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : unsigned formats and signed & other types of values ***
-
--- Iteration 1 --
-2 0 10
- 123456 u 1234 2820130816
- 2840207360 1177509888 12345
- 12 4294967284 4294843840 _3
- 10 123456 2 0
--- Iteration 2 --
-0 0 0
- 123 u 4294967173 123
- 0 0 0
- 1234 0 $0 _0
- 0 123 0 0
--- Iteration 3 --
-1 1 1
- 1 u 1 1
- 1 1 1
- #1 1 $1 _1
- 1 1 1 1
--- Iteration 4 --
-1 1 0
- 1 u 0 1
- 1 1 0
- #0 1 $1 _0
- 0 1 1 1
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - unsigned formats with signed and other types of values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different unsigned formats and signed values and other types of values
- * are passed to the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : unsigned formats and signed & other types of values ***\n";
-
-// defining array of unsigned formats
-$formats =
- '%u %+u %-u
- %lu %Lu %4u %-4u
- %10.4u %-10.4u %.4u
- %\'#2u %\'2u %\'$2u %\'_2u
- %3$u %4$u %1$u %2$u';
-
-// Arrays of signed and other type of values for the format defined in $format.
-// Each sub array contains signed values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(+2.2, +.2, +10.2,
- +123456.234, +123456.234, +1234.6789,
- +2e10, +2e12, +22e+12,
- +12345.780, +12.000000011111, -12.00000111111, -123456.234,
- +3.33, +4.44, +1.11,-2.22 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation16_64bit.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different unsigned formats from the above $format array
-// and with signed and other types of values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : unsigned formats and signed & other types of values ***
-
--- Iteration 1 --
-2 0 10
- 123456 u 1234 20000000000
- 2000000000000 22000000000000 12345
- 12 18446744073709551604 18446744073709428160 _3
- 10 123456 2 0
--- Iteration 2 --
-0 0 0
- 123 u 18446744073709551493 123
- 0 0 0
- 1234 0 $0 _0
- 0 123 0 0
--- Iteration 3 --
-1 1 1
- 1 u 1 1
- 1 1 1
- #1 1 $1 _1
- 1 1 1 1
--- Iteration 4 --
-1 1 0
- 1 u 0 1
- 1 1 0
- #0 1 $1 _0
- 0 1 1 1
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - scientific formats with scientific values
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different scientific formats and scientific values
- * are passed to the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : scientific formats and scientific values ***\n";
-
-// defining array of scientific formats
-$formats = array(
- '%e %+e %-e',
- '%le %Le %4e %-4e',
- '%10.4e %-10.4e %.4e',
- '%\'#20e %\'20e %\'$20e %\'_20e',
- '%3$e %4$e %1$e %2$e'
-);
-
-// Arrays of scientific values for the format defined in $format.
-// Each sub array contains scientific values which correspond to each format string in $format
-$args_array = array(
- array(0, 1e0, "10e2" ),
- array(2.2e2, 10e10, 1000e-2, 1000e7),
- array(-22e12, 10e20, 1.2e2),
- array(1e1, +1e2, -1e3, "1e2_"),
- array(3e3, 4e3, 1e3, 2e3)
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation17.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different scientific formats from the above $format array
-// and with signed and other types of values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-?>
---EXPECT--
-*** Testing vfprintf() : scientific formats and scientific values ***
-
--- Iteration 1 --
-0.000000e+0 +1.000000e+0 1.000000e+3
--- Iteration 2 --
-2.200000e+2 e 1.000000e+1 1.000000e+10
--- Iteration 3 --
--2.2000e+13 1.0000e+21 1.2000e+2
--- Iteration 4 --
-#########1.000000e+1 1.000000e+2 $$$$$$$$-1.000000e+3 _________1.000000e+2
--- Iteration 5 --
-1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - scientific formats with non-scientific values
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different scientific formats and non-scientific values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : scientific formats and non-scientific values ***\n";
-
-// defining array of non-scientific formats
-$formats =
- '%e %+e %-e
- %le %Le %4e %-4e
- %10.4e %-10.4e %04e %04.4e
- %\'#2e %\'2e %\'$2e %\'_2e
- %3$e %4$e %1$e %2$e';
-
-// Arrays of non scientific values for the format defined in $format.
-// Each sub array contains non scientific values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 20.00, +212.2, -411000000000, 2212.000000000001,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation18.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different scientific formats from the above $format array
-// and with non-scientific values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-?>
---EXPECT--
-*** Testing vfprintf() : scientific formats and non-scientific values ***
-
--- Iteration 1 --
-2.200000e+0 +2.000000e-1 1.020000e+1
- 1.234562e+5 e -1.234679e+3 1.234679e+3
- 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3
- 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5
- 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1
--- Iteration 2 --
-0.000000e+0 +0.000000e+0 0.000000e+0
- 1.230000e+2 e -1.230000e+2 1.230000e+2
- 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0
- 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0
- 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0
--- Iteration 3 --
-1.000000e+0 +1.000000e+0 1.000000e+0
- 1.000000e+0 e 1.000000e+0 1.000000e+0
- 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0
- 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
- 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
--- Iteration 4 --
-1.000000e+0 +1.000000e+0 0.000000e+0
- 1.000000e+0 e 0.000000e+0 1.000000e+0
- 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0
- 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0
- 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - with whitespaces in format strings
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-echo "*** Testing vfprintf() : with white spaces in format strings ***\n";
-
-// initializing the format array
-$formats = array(
- "% d % d % d",
- "% f % f % f",
- "% F % F % F",
- "% b % b % b",
- "% c % c % c",
- "% e % e % e",
- "% u % u % u",
- "% o % o % o",
- "% x % x % x",
- "% X % X % X",
- "% E % E % E"
-);
-
-// initializing the args array
-
-$args_array = array(
- array(111, 222, 333),
- array(1.1, .2, -0.6),
- array(1.12, -1.13, +0.23),
- array(1, 2, 3),
- array(65, 66, 67),
- array(2e1, 2e-1, -2e1),
- array(-11, +22, 33),
- array(012, -023, +023),
- array(0x11, -0x22, +0x33),
- array(0x11, -0x22, +0x33),
- array(2e1, 2e-1, -2e1)
-);
-
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation19.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different scientific formats from the above $format array
-// and with non-scientific values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp,$format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-?>
---EXPECT--
-*** Testing vfprintf() : with white spaces in format strings ***
-
--- Iteration 1 --
-111 222 333
--- Iteration 2 --
-1.100000 0.200000 -0.600000
--- Iteration 3 --
-1.120000 -1.130000 0.230000
--- Iteration 4 --
-1 10 11
--- Iteration 5 --
-A B C
--- Iteration 6 --
-2.000000e+1 2.000000e-1 -2.000000e+1
--- Iteration 7 --
-4294967285 22 33
--- Iteration 8 --
-12 37777777755 23
--- Iteration 9 --
-11 ffffffde 33
--- Iteration 10 --
-11 FFFFFFDE 33
--- Iteration 11 --
-2.000000E+1 2.000000E-1 -2.000000E+1
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - with whitespaces in format strings
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-echo "*** Testing vfprintf() : with white spaces in format strings ***\n";
-
-// initializing the format array
-$formats = array(
- "% d % d % d",
- "% f % f % f",
- "% F % F % F",
- "% b % b % b",
- "% c % c % c",
- "% e % e % e",
- "% u % u % u",
- "% o % o % o",
- "% x % x % x",
- "% X % X % X",
- "% E % E % E"
-);
-
-// initializing the args array
-
-$args_array = array(
- array(111, 222, 333),
- array(1.1, .2, -0.6),
- array(1.12, -1.13, +0.23),
- array(1, 2, 3),
- array(65, 66, 67),
- array(2e1, 2e-1, -2e1),
- array(-11, +22, 33),
- array(012, -023, +023),
- array(0x11, -0x22, +0x33),
- array(0x11, -0x22, +0x33),
- array(2e1, 2e-1, -2e1)
-);
-
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation19_64bit.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different scientific formats from the above $format array
-// and with non-scientific values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp,$format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-?>
---EXPECT--
-*** Testing vfprintf() : with white spaces in format strings ***
-
--- Iteration 1 --
-111 222 333
--- Iteration 2 --
-1.100000 0.200000 -0.600000
--- Iteration 3 --
-1.120000 -1.130000 0.230000
--- Iteration 4 --
-1 10 11
--- Iteration 5 --
-A B C
--- Iteration 6 --
-2.000000e+1 2.000000e-1 -2.000000e+1
--- Iteration 7 --
-18446744073709551605 22 33
--- Iteration 8 --
-12 1777777777777777777755 23
--- Iteration 9 --
-11 ffffffffffffffde 33
--- Iteration 10 --
-11 FFFFFFFFFFFFFFDE 33
--- Iteration 11 --
-2.000000E+1 2.000000E-1 -2.000000E+1
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - unexpected values for the format argument
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different unexpected format strings are passed to
- * the '$format' argument of the function
-*/
-
-echo "*** Testing vfprintf() : with unexpected values for format argument ***\n";
-
-// initialising the required variables
-$args = array(1, 2);
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// declaring a class
-class sample
-{
- public function __toString() {
- return "object";
- }
-}
-
-// Defining resource
-$file_handle = fopen(__FILE__, 'r');
-
-
-//array of values to iterate over
-$values = array(
-
- // int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // float data
-/*5*/ 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
-
- // array data
-/*10*/ array(),
- array(0),
- array(1),
- array(1,2),
- array('color' => 'red', 'item' => 'pen'),
-
- // null data
-/*15*/ NULL,
- null,
-
- // boolean data
-/*17*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
-/*21*/ "",
- '',
-
- // object data
-/*23*/ new sample(),
-
- // undefined data
-/*24*/ @$undefined_var,
-
- // unset data
-/*25*/ @$unset_var,
-
- // resource data
-/*26*/ $file_handle
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation20.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-fprintf($fp, "\n*** Testing vprintf() with with unexpected values for format argument ***\n");
-
-$counter = 1;
-foreach( $values as $value ) {
- fprintf($fp, "\n-- Iteration %d --\n", $counter);
-
- try {
- vfprintf($fp, $value, $args);
- } catch (TypeError $exception) {
- fprintf($fp, "%s\n", $exception->getMessage());
- }
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : with unexpected values for format argument ***
-
-*** Testing vprintf() with with unexpected values for format argument ***
-
--- Iteration 1 --
-0
--- Iteration 2 --
-1
--- Iteration 3 --
-12345
--- Iteration 4 --
--2345
--- Iteration 5 --
-10.5
--- Iteration 6 --
--10.5
--- Iteration 7 --
-101234567000
--- Iteration 8 --
-1.07654321E-9
--- Iteration 9 --
-0.5
--- Iteration 10 --
-vfprintf(): Argument #2 ($format) must be of type string, array given
-
--- Iteration 11 --
-vfprintf(): Argument #2 ($format) must be of type string, array given
-
--- Iteration 12 --
-vfprintf(): Argument #2 ($format) must be of type string, array given
-
--- Iteration 13 --
-vfprintf(): Argument #2 ($format) must be of type string, array given
-
--- Iteration 14 --
-vfprintf(): Argument #2 ($format) must be of type string, array given
-
--- Iteration 15 --
-
--- Iteration 16 --
-
--- Iteration 17 --
-1
--- Iteration 18 --
-
--- Iteration 19 --
-1
--- Iteration 20 --
-
--- Iteration 21 --
-
--- Iteration 22 --
-
--- Iteration 23 --
-object
--- Iteration 24 --
-
--- Iteration 25 --
-
--- Iteration 26 --
-vfprintf(): Argument #2 ($format) must be of type string, resource given
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - unexpected values for args argument
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different unexpected values are passed to
- * the '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : with unexpected values for args argument ***\n";
-
-// initialising the required variables
-$format = '%s';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// declaring a class
-class sample
-{
- public function __toString() {
- return "object";
- }
-}
-
-// Defining resource
-$file_handle = fopen(__FILE__, 'r');
-
-
-//array of values to iterate over
-$values = array(
-
- // int data
-/*1*/ 0,
- 1,
- 12345,
- -2345,
-
- // float data
-/*5*/ 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
-
- // null data
-/*10*/ NULL,
- null,
-
- // boolean data
-/*12*/ true,
- false,
- TRUE,
- FALSE,
-
- // empty data
-/*16*/ "",
- '',
-
- // string data
-/*18*/ "string",
- 'string',
-
- // object data
-/*20*/ new sample(),
-
- // undefined data
-/*21*/ @$undefined_var,
-
- // unset data
-/*22*/ @$unset_var,
-
- // resource data
-/*23*/ $file_handle
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation21.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-fprintf($fp, "\n*** Testing vprintf() with unexpected values for args argument ***\n");
-
-$counter = 1;
-foreach( $values as $value ) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- try {
- vfprintf($fp, $format, $value);
- } catch (\ValueError $e) {
- fwrite($fp, $e->getMessage() . "\n");
- }
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-
-?>
---EXPECTF--
-*** Testing vfprintf() : with unexpected values for args argument ***
-
-*** Testing vprintf() with unexpected values for args argument ***
-
--- Iteration 1 --
-0
--- Iteration 2 --
-1
--- Iteration 3 --
-12345
--- Iteration 4 --
--2345
--- Iteration 5 --
-10.5
--- Iteration 6 --
--10.5
--- Iteration 7 --
-101234567000
--- Iteration 8 --
-1.07654321E-9
--- Iteration 9 --
-0.5
--- Iteration 10 --
-The arguments array must contain 1 items, 0 given
-
--- Iteration 11 --
-The arguments array must contain 1 items, 0 given
-
--- Iteration 12 --
-1
--- Iteration 13 --
-
--- Iteration 14 --
-1
--- Iteration 15 --
-
--- Iteration 16 --
-
--- Iteration 17 --
-
--- Iteration 18 --
-string
--- Iteration 19 --
-string
--- Iteration 20 --
-The arguments array must contain 1 items, 0 given
-
--- Iteration 21 --
-The arguments array must contain 1 items, 0 given
-
--- Iteration 22 --
-The arguments array must contain 1 items, 0 given
-
--- Iteration 23 --
-Resource id #%d
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - int formats with int values
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different int formats and int values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : int formats with int values ***\n";
-
-
-// defining array of int formats
-$formats = array(
- "%d",
- "%+d %-d %D",
- "%ld %Ld, %4d %-4d",
- "%10.4d %-10.4d %04d %04.4d",
- "%'#2d %'2d %'$2d %'_2d",
- "%d %d %d %d",
- "% %%d d%",
- '%3$d %4$d %1$d %2$d'
-);
-
-// Arrays of int values for the format defined in $format.
-// Each sub array contains int values which correspond to each format string in $format
-$args_array = array(
- array(0),
- array(-1, 1, +22),
- array(2147483647, -2147483648, +2147483640, -2147483640),
- array(123456, 12345678, -1234567, 1234567),
- array(111, 2222, 333333, 44444444),
- array(0x123b, 0xfAb, 0123, 012),
- array(1234, -5678, 2345),
- array(3, 4, 1, 2)
-
-);
-
-// looping to test vfprintf() with different int formats from the above $format array
-// and with int values from the above $args_array array
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation3.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : int formats with int values ***
-
--- Iteration 1 --
-0
--- Iteration 2 --
--1 1
--- Iteration 3 --
-2147483647 d, 2147483640 -2147483640
--- Iteration 4 --
- 123456 12345678 -1234567 1234567
--- Iteration 5 --
-111 2222 333333 44444444
--- Iteration 6 --
-4667 4011 83 10
--- Iteration 7 --
-%-5678 d
--- Iteration 8 --
-1 2 3 4
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - int formats with non-integer values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different int formats and non-int values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : int formats and non-integer values ***\n";
-
-// defining array of int formats
-$formats =
- '%d %+d %-d
- %ld %Ld %4d %-4d
- %10.4d %-10.4d %.4d %04.4d
- %\'#2d %\'2d %\'$2d %\'_2d
- %3$d %4$d %1$d %2$d';
-
-// Arrays of non int values for the format defined in $format.
-// Each sub array contains non int values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e5, 4e3, 22e+6,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation4.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different int formats from the above $format array
-// and with non-int values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : int formats and non-integer values ***
-
--- Iteration 1 --
-2 +0 10
- 123456 d -1234 1234
- -1474836480 200000 4000 22000000
- 12345 12 -12 -123456
- 10 123456 2 0
--- Iteration 2 --
-0 +0 0
- 123 d -123 123
- 0 0 123456 0000
- 1234 0 $0 _0
- 0 123 0 0
--- Iteration 3 --
-1 +1 1
- 1 d 1 1
- 1 1 1 0001
- #1 1 $1 _1
- 1 1 1 1
--- Iteration 4 --
-1 +1 0
- 1 d 0 1
- 1 0 1 0000
- #0 1 $1 _0
- 0 1 1 1
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - int formats with non-integer values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different int formats and non-int values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : int formats and non-integer values ***\n";
-
-// defining array of int formats
-$formats =
- '%d %+d %-d
- %ld %Ld %4d %-4d
- %10.4d %-10.4d %.4d %04.4d
- %\'#2d %\'2d %\'$2d %\'_2d
- %3$d %4$d %1$d %2$d';
-
-// Arrays of non int values for the format defined in $format.
-// Each sub array contains non int values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e5, 4e3, 22e+6,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22
- ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation4_64bit.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different int formats from the above $format array
-// and with non-int values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : int formats and non-integer values ***
-
--- Iteration 1 --
-2 +0 10
- 123456 d -1234 1234
- 20000000000 200000 4000 22000000
- 12345 12 -12 -123456
- 10 123456 2 0
--- Iteration 2 --
-0 +0 0
- 123 d -123 123
- 0 0 123456 0000
- 1234 0 $0 _0
- 0 123 0 0
--- Iteration 3 --
-1 +1 1
- 1 d 1 1
- 1 1 1 0001
- #1 1 $1 _1
- 1 1 1 1
--- Iteration 4 --
-1 +1 0
- 1 d 0 1
- 1 0 1 0000
- #0 1 $1 _0
- 0 1 1 1
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - float formats with float values
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different float formats and float values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : int formats with float values ***\n";
-
-
-// defining array of float formats
-$formats = array(
- "%f",
- "%+f %-f %F",
- "%lf %Lf, %4f %-4f",
- "%10.4f %-10.4F %04f %04.4f",
- "%'#2f %'2f %'$2f %'_2f",
- "%f %f %f %f",
- "% %%f f%",
- '%3$f %4$f %1$f %2$f'
-);
-
-// Arrays of float values for the format defined in $format.
-// Each sub array contains float values which correspond to each format string in $format
-$args_array = array(
- array(0.0),
- array(-0.1, +0.1, +10.0000006),
- array(2147483649, -2147483647, +2147483640, -2147483640),
- array(2e5, 2e-5, -2e5, -2e-5),
- array(0.2E5, -0.2e40, 0.2E-20, 0.2E+20),
- array(0x123b, 0xfAb, 0123, 012),
- array(1234.1234, -5678.5678, 2345.2345),
- array(3.33, 4.44, 1.11, 2.22)
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation5.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vprintf() with different float formats from the above $format array
-// and with float values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $format, $args_array[$counter-1]);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : int formats with float values ***
-
--- Iteration 1 --
-0.000000
--- Iteration 2 --
--0.100000 0.100000 10.000001
--- Iteration 3 --
-2147483649.000000 f, 2147483640.000000 -2147483640.000000
--- Iteration 4 --
-200000.0000 0.0000 -200000.000000 -0.0000
--- Iteration 5 --
-20000.000000 -1999999999999999879418332743206357172224.000000 0.000000 20000000000000000000.000000
--- Iteration 6 --
-4667.000000 4011.000000 83.000000 10.000000
--- Iteration 7 --
-%-5678.567800 f
--- Iteration 8 --
-1.110000 2.220000 3.330000 4.440000
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - float formats with non-float values
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different float formats and non-float values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : float formats and non-float values ***\n";
-
-// defining array of float formats
-$formats =
- '%f %+f %-f
- %lf %Lf %4f %-4f
- %10.4f %-10.4f %04f %04.4f
- %\'#2f %\'2f %\'$2f %\'_2f
- %3$f %4$f %1$f %2$f';
-
-// Arrays of non float values for the format defined in $format.
-// Each sub array contains non float values which correspond to each format in $format
-$args_array = array(
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, -40000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation6.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different float formats from the above $format array
-// and with non-float values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECT--
-*** Testing vfprintf() : float formats and non-float values ***
-
--- Iteration 1 --
-2.000000 -2.000000 2.000000
- 123456.000000 f -12346789.000000 12346789.000000
- 123200.0000 20000.0000 -40000.000000 22212.0000
- 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000
- 2.000000 123456.000000 2.000000 -2.000000
--- Iteration 2 --
-0.000000 +0.000000 0.000000
- 123.000000 f -123.000000 123.000000
- 0.0000 0.0000 123456.000000 0.0000
- 1234.000000 0.000000 0.000000 0.000000
- 0.000000 123.000000 0.000000 0.000000
--- Iteration 3 --
-1.000000 +1.000000 1.000000
- 1.000000 f 1.000000 1.000000
- 1.0000 1.0000 1.000000 1.0000
- 1.000000 1.000000 1.000000 1.000000
- 1.000000 1.000000 1.000000 1.000000
--- Iteration 4 --
-1.000000 +1.000000 0.000000
- 1.000000 f 0.000000 1.000000
- 1.0000 0.0000 1.000000 0.0000
- 0.000000 1.000000 1.000000 0.000000
- 0.000000 1.000000 1.000000 1.000000
+++ /dev/null
---TEST--
-Test vfprintf() function : usage variations - string formats with non-string values
---FILE--
-<?php
-/* Prototype : int vfprintf ( resource $handle , string $format , array $args )
- * Description: Write a formatted string to a stream
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vfprintf() when different string formats and non-string values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vfprintf() : string formats and non-string values ***\n";
-
-// defining array of string formats
-$formats =
- '%s %+s %-s
- %ls %Ls %4s %-4s
- %10.4s %-10.4s %04s %04.4s
- %\'#2s %\'2s %\'$2s %\'_2s
- %3$s %4$s %1$s %2$s';
-
-// Arrays of non string values for the format defined in $format.
-// Each sub array contains non string values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2.1234567e10, +2.7654321e10, -2.7654321e10,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, -40000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-/* creating dumping file */
-$data_file = __DIR__ . '/vfprintf_variation8.txt';
-if (!($fp = fopen($data_file, 'wt')))
- return;
-
-// looping to test vfprintf() with different string formats from the above $format array
-// and with non-string values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- fprintf($fp, "\n-- Iteration %d --\n",$counter);
- vfprintf($fp, $formats, $args);
- $counter++;
-}
-
-fclose($fp);
-print_r(file_get_contents($data_file));
-echo "\n";
-
-unlink($data_file);
-
-?>
---EXPECTF--
-*** Testing vfprintf() : string formats and non-string values ***
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
--- Iteration 1 --
-2.2 0.2 10.2
- 123456.234 s -1234.6789 1234.6789
- 2123 2765 -27654321000 1234
- 12.000000011111 -12.00000111111 -123456.234 3.33
- 10.2 123456.234 2.2 0.2
--- Iteration 2 --
-2 -2 2
- 123456 s -12346789 12346789
- 1232 2000 -40000 2221
- 12345780 1211111 -12111111 -12345634
- 2 123456 2 -2
--- Iteration 3 --
-Array Array Array
- Array s Array Array
- Arra Arra Array Arra
- Array Array Array Array
- Array Array Array Array
--- Iteration 4 --
-1 1
- 1 s 1
- 1 0001 0000
- #0 1 $1 _0
- 1 1 1
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - unexpected values for the format argument
---FILE--
-<?php
-/* Prototype : string vsprintf(string $format, array $args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different unexpected format strings are passed to
- * the '$format' argument of the function
-*/
-
-echo "*** Testing vsprintf() : with unexpected values for format argument ***\n";
-
-// initialising the required variables
-$args = array(1, 2);
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// declaring a class
-class sample
-{
- public function __toString() {
- return "object";
- }
-}
-
-// Defining resource
-$file_handle = fopen(__FILE__, 'r');
-
-
-//array of values to iterate over
-$values = array(
-
- // int data
- 0,
- 1,
- 12345,
- -2345,
-
- // float data
- 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
-
- // array data
- array(),
- array(0),
- array(1),
- array(1,2),
- array('color' => 'red', 'item' => 'pen'),
-
- // null data
- NULL,
- null,
-
- // boolean data
- true,
- false,
- TRUE,
- FALSE,
-
- // empty data
- "",
- '',
-
- // object data
- new sample(),
-
- // undefined data
- @$undefined_var,
-
- // unset data
- @$unset_var,
-
- // resource data
- $file_handle
-);
-
-// loop through each element of the array for format
-
-$counter = 1;
-foreach($values as $value) {
- echo "\n -- Iteration $counter --\n";
- try {
- var_dump(vsprintf($value, $args));
- } catch (TypeError $exception) {
- echo $exception->getMessage() . "\n";
- }
- $counter++;
-}
-
-// closing the resource
-fclose($file_handle);
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : with unexpected values for format argument ***
-
- -- Iteration 1 --
-string(1) "0"
-
- -- Iteration 2 --
-string(1) "1"
-
- -- Iteration 3 --
-string(5) "12345"
-
- -- Iteration 4 --
-string(5) "-2345"
-
- -- Iteration 5 --
-string(4) "10.5"
-
- -- Iteration 6 --
-string(5) "-10.5"
-
- -- Iteration 7 --
-string(12) "101234567000"
-
- -- Iteration 8 --
-string(13) "1.07654321E-9"
-
- -- Iteration 9 --
-string(3) "0.5"
-
- -- Iteration 10 --
-vsprintf(): Argument #1 ($format) must be of type string, array given
-
- -- Iteration 11 --
-vsprintf(): Argument #1 ($format) must be of type string, array given
-
- -- Iteration 12 --
-vsprintf(): Argument #1 ($format) must be of type string, array given
-
- -- Iteration 13 --
-vsprintf(): Argument #1 ($format) must be of type string, array given
-
- -- Iteration 14 --
-vsprintf(): Argument #1 ($format) must be of type string, array given
-
- -- Iteration 15 --
-string(0) ""
-
- -- Iteration 16 --
-string(0) ""
-
- -- Iteration 17 --
-string(1) "1"
-
- -- Iteration 18 --
-string(0) ""
-
- -- Iteration 19 --
-string(1) "1"
-
- -- Iteration 20 --
-string(0) ""
-
- -- Iteration 21 --
-string(0) ""
-
- -- Iteration 22 --
-string(0) ""
-
- -- Iteration 23 --
-string(6) "object"
-
- -- Iteration 24 --
-string(0) ""
-
- -- Iteration 25 --
-string(0) ""
-
- -- Iteration 26 --
-vsprintf(): Argument #1 ($format) must be of type string, resource given
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - octal formats with octal values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different octal formats and octal values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : octal formats with octal values ***\n";
-
-// defining array of octal formats
-$formats = array(
- "%o",
- "%+o %-o %O",
- "%lo %Lo, %4o %-4o",
- "%10.4o %-10.4o %04o %04.4o",
- "%'#2o %'2o %'$2o %'_2o",
- "%o %o %o %o",
- "%% %%o %10 o%",
- '%3$o %4$o %1$o %2$o'
-);
-
-// Arrays of octal values for the format defined in $format.
-// Each sub array contains octal values which correspond to each format string in $format
-$args_array = array(
- array(00),
- array(-01, 01, +022),
- array(-020000000000, 020000000000, 017777777777, -017777777777),
- array(0123456, 01234567, -01234567, 01234567),
- array(0111, 02222, -0333333, -044444444),
- array(0x123b, 0xfAb, 0123, 012),
- array(01234, 0567, -01234, 02345),
- array(03, 04, 01, 02)
-
-);
-
-// looping to test vsprintf() with different octal formats from the above $formats array
-// and with octal values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : octal formats with octal values ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(14) "37777777777 1 "
-
--- Iteration 3 --
-string(38) "20000000000 o, 17777777777 20000000001"
-
--- Iteration 4 --
-string(38) " 37776543211 0000"
-
--- Iteration 5 --
-string(32) "111 2222 37777444445 37733333334"
-
--- Iteration 6 --
-string(17) "11073 7653 123 12"
-
--- Iteration 7 --
-string(6) "% %o o"
-
--- Iteration 8 --
-string(7) "1 2 3 4"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - octal formats with octal values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different octal formats and octal values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : octal formats with octal values ***\n";
-
-// defining array of octal formats
-$formats = array(
- "%o",
- "%+o %-o %O",
- "%lo %Lo, %4o %-4o",
- "%10.4o %-10.4o %04o %04.4o",
- "%'#2o %'2o %'$2o %'_2o",
- "%o %o %o %o",
- "%% %%o %10 o%",
- '%3$o %4$o %1$o %2$o'
-);
-
-// Arrays of octal values for the format defined in $format.
-// Each sub array contains octal values which correspond to each format string in $format
-$args_array = array(
- array(00),
- array(-01, 01, +022),
- array(-020000000000, 020000000000, 017777777777, -017777777777),
- array(0123456, 01234567, -01234567, 01234567),
- array(0111, 02222, -0333333, -044444444),
- array(0x123b, 0xfAb, 0123, 012),
- array(01234, 0567, -01234, 02345),
- array(03, 04, 01, 02)
-
-);
-
-// looping to test vsprintf() with different octal formats from the above $formats array
-// and with octal values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : octal formats with octal values ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(25) "1777777777777777777777 1 "
-
--- Iteration 3 --
-string(60) "1777777777760000000000 o, 17777777777 1777777777760000000001"
-
--- Iteration 4 --
-string(49) " 1777777777777776543211 0000"
-
--- Iteration 5 --
-string(54) "111 2222 1777777777777777444445 1777777777777733333334"
-
--- Iteration 6 --
-string(17) "11073 7653 123 12"
-
--- Iteration 7 --
-string(6) "% %o o"
-
--- Iteration 8 --
-string(7) "1 2 3 4"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - octal formats with non-octal values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different octal formats and non-octal values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : octal formats and non-octal values ***\n";
-
-// defining array of octal formats
-$formats =
- '%o %+o %-o
- %lo %Lo %4o %-4o
- %10.4o %-10.4o %.4o
- %\'#2o %\'2o %\'$2o %\'_2o
- %3$o %4$o %1$o %2$o';
-
-// Arrays of non octal values for the format defined in $format.
-// Each sub array contains non octal values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e12, 22e+12,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different octal formats from the above $format array
-// and with non-octal values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : octal formats and non-octal values ***
-
--- Iteration 1 --
-string(114) "2 0 12
- 361100 o 37777775456 2322
-
- 30071 14 37777777764 37777416700
- 12 361100 2 0"
-
--- Iteration 2 --
-string(144) "2 37777777776 2
- 361100 o 37720715133 57062645
-
- 57060664 4475347 37721631371 37720717336
- 2 361100 2 37777777776"
-
--- Iteration 3 --
-string(86) "0 0 0
- 173 o 37777777605 173
-
- 2322 0 $0 _0
- 0 173 0 0"
-
--- Iteration 4 --
-string(73) "1 1 1
- 1 o 1 1
-
- #1 1 $1 _1
- 1 1 1 1"
-
--- Iteration 5 --
-string(73) "1 1 0
- 1 o 0 1
-
- #0 1 $1 _0
- 0 1 1 1"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - octal formats with non-octal values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different octal formats and non-octal values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : octal formats and non-octal values ***\n";
-
-// defining array of octal formats
-$formats =
- '%o %+o %-o
- %lo %Lo %4o %-4o
- %10.4o %-10.4o %.4o
- %\'#2o %\'2o %\'$2o %\'_2o
- %3$o %4$o %1$o %2$o';
-
-// Arrays of non octal values for the format defined in $format.
-// Each sub array contains non octal values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e12, 22e+12,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different octal formats from the above $format array
-// and with non-octal values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : octal formats and non-octal values ***
-
--- Iteration 1 --
-string(151) "2 0 12
- 361100 o 1777777777777777775456 2322
-
- 30071 14 1777777777777777777764 1777777777777777416700
- 12 361100 2 0"
-
--- Iteration 2 --
-string(203) "2 1777777777777777777776 2
- 361100 o 1777777777777720715133 57062645
-
- 57060664 4475347 1777777777777721631371 1777777777777720717336
- 2 361100 2 1777777777777777777776"
-
--- Iteration 3 --
-string(101) "0 0 0
- 173 o 1777777777777777777605 173
-
- 2322 0 $0 _0
- 0 173 0 0"
-
--- Iteration 4 --
-string(77) "1 1 1
- 1 o 1 1
-
- #1 1 $1 _1
- 1 1 1 1"
-
--- Iteration 5 --
-string(77) "1 1 0
- 1 o 0 1
-
- #0 1 $1 _0
- 0 1 1 1"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - hexa formats with hexa values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different hexa formats and hexa values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : hexa formats with hexa values ***\n";
-
-// defining array of different hexa formats
-$formats = array(
- "%x",
- "%+x %-x %X",
- "%lx %Lx, %4x %-4x",
- "%10.4x %-10.4x %04x %04.4x",
- "%'#2x %'2x %'$2x %'_2x",
- "%x %x %x %x",
- "% %%x x%",
- '%3$x %4$x %1$x %2$x'
-);
-
-// Arrays of hexa values for the format defined in $format.
-// Each sub array contains hexa values which correspond to each format string in $format
-$args_array = array(
- array(0x0),
- array(-0x1, 0x1, +0x22),
- array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
- array(123456, 12345678, -1234567, 1234567),
- array(1, 0x2222, 0333333, -0x44444444),
- array(0x123b, 0xfAb, "0xaxz", 012),
- array(0x1234, 0x34, 0x2ff),
- array(0x3, 0x4, 0x1, 0x2)
-
-);
-
-// looping to test vsprintf() with different char octal from the above $format array
-// and with octal values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : hexa formats with hexa values ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(13) "ffffffff 1 22"
-
--- Iteration 3 --
-string(28) "7fffffff x, 7000000 80000000"
-
--- Iteration 4 --
-string(35) " ffed2979 0000"
-
--- Iteration 5 --
-string(22) "#1 2222 1b6db bbbbbbbc"
-
--- Iteration 6 --
-string(12) "123b fab 0 a"
-
--- Iteration 7 --
-string(5) "%34 x"
-
--- Iteration 8 --
-string(7) "1 2 3 4"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - hexa formats with hexa values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different hexa formats and hexa values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : hexa formats with hexa values ***\n";
-
-// defining array of different hexa formats
-$formats = array(
- "%x",
- "%+x %-x %X",
- "%lx %Lx, %4x %-4x",
- "%10.4x %-10.4x %04x %04.4x",
- "%'#2x %'2x %'$2x %'_2x",
- "%x %x %x %x",
- "% %%x x%",
- '%3$x %4$x %1$x %2$x'
-);
-
-// Arrays of hexa values for the format defined in $format.
-// Each sub array contains hexa values which correspond to each format string in $format
-$args_array = array(
- array(0x0),
- array(-0x1, 0x1, +0x22),
- array(0x7FFFFFFF, -0x7fffffff, +0x7000000, -0x80000000),
- array(123456, 12345678, -1234567, 1234567),
- array(1, 0x2222, 0333333, -0x44444444),
- array(0x123b, 0xfAb, "0xaxz", 012),
- array(0x1234, 0x34, 0x2ff),
- array(0x3, 0x4, 0x1, 0x2)
-
-);
-
-// looping to test vsprintf() with different char octal from the above $format array
-// and with octal values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : hexa formats with hexa values ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(21) "ffffffffffffffff 1 22"
-
--- Iteration 3 --
-string(36) "7fffffff x, 7000000 ffffffff80000000"
-
--- Iteration 4 --
-string(43) " ffffffffffed2979 0000"
-
--- Iteration 5 --
-string(30) "#1 2222 1b6db ffffffffbbbbbbbc"
-
--- Iteration 6 --
-string(12) "123b fab 0 a"
-
--- Iteration 7 --
-string(5) "%34 x"
-
--- Iteration 8 --
-string(7) "1 2 3 4"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - hexa formats with non-hexa values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different hexa formats and non-hexa values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : hexa formats and non-hexa values ***\n";
-
-// defining array of different hexa formats
-$formats =
- '%x %+x %-x
- %lx %Lx %4x %-4x
- %10.4x %-10.4x %.4x
- %\'#2x %\'2x %\'$2x %\'_2x
- %3$x %4$x %1$x %2$x';
-
-// Arrays of non hexa values for the format defined in $format.
-// Each sub array contains non hexa values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e12, 22e+12,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different hexa formats from the above $format array
-// and with non-hexa values from the above $args_array array
-
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : hexa formats and non-hexa values ***
-
--- Iteration 1 --
-string(99) "2 0 a
- 1e240 x fffffb2e 4d2
-
- 3039 c fffffff4 fffe1dc0
- a 1e240 2 0"
-
--- Iteration 2 --
-string(122) "2 fffffffe 2
- 1e240 x ff439a5b bc65a5
-
- bc61b4 127ae7 ff4732f9 ff439ede
- 2 1e240 2 fffffffe"
-
--- Iteration 3 --
-string(80) "0 0 0
- 7b x ffffff85 7b
-
- 4d2 0 $0 _0
- 0 7b 0 0"
-
--- Iteration 4 --
-string(73) "1 1 1
- 1 x 1 1
-
- #1 1 $1 _1
- 1 1 1 1"
-
--- Iteration 5 --
-string(73) "1 1 0
- 1 x 0 1
-
- #0 1 $1 _0
- 0 1 1 1"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - hexa formats with non-hexa values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different hexa formats and non-hexa values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : hexa formats and non-hexa values ***\n";
-
-// defining array of different hexa formats
-$formats =
- '%x %+x %-x
- %lx %Lx %4x %-4x
- %10.4x %-10.4x %.4x
- %\'#2x %\'2x %\'$2x %\'_2x
- %3$x %4$x %1$x %2$x';
-
-// Arrays of non hexa values for the format defined in $format.
-// Each sub array contains non hexa values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e12, 22e+12,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different hexa formats from the above $format array
-// and with non-hexa values from the above $args_array array
-
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : hexa formats and non-hexa values ***
-
--- Iteration 1 --
-string(127) "2 0 a
- 1e240 x fffffffffffffb2e 4d2
-
- 3039 c fffffffffffffff4 fffffffffffe1dc0
- a 1e240 2 0"
-
--- Iteration 2 --
-string(166) "2 fffffffffffffffe 2
- 1e240 x ffffffffff439a5b bc65a5
-
- bc61b4 127ae7 ffffffffff4732f9 ffffffffff439ede
- 2 1e240 2 fffffffffffffffe"
-
--- Iteration 3 --
-string(92) "0 0 0
- 7b x ffffffffffffff85 7b
-
- 4d2 0 $0 _0
- 0 7b 0 0"
-
--- Iteration 4 --
-string(77) "1 1 1
- 1 x 1 1
-
- #1 1 $1 _1
- 1 1 1 1"
-
--- Iteration 5 --
-string(77) "1 1 0
- 1 x 0 1
-
- #0 1 $1 _0
- 0 1 1 1"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - unsigned formats with unsigned values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different unsigned formats and unsigned values
- * are passed to the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : unsigned formats and unsigned values ***\n";
-
-// defining array of unsigned formats
-$formats = array(
- '%u %+u %-u',
- '%lu %Lu %4u %-4u',
- '%10.4u %-10.4u %.4u',
- '%\'#2u %\'2u %\'$2u %\'_2u',
- '%3$u %4$u %1$u %2$u'
-);
-
-// Arrays of unsigned values for the format defined in $format.
-// Each sub array contains unsigned values which correspond to each format string in $format
-$args_array = array(
- array(1234567, 01234567, 0 ),
- array(12345678900, 12345678900, 1234, 12345),
- array("1234000", 10.1234567e5, 1.2e2),
- array(1, 0, 00, "10_"),
- array(3, 4, 1, 2)
-);
-
-// looping to test vsprintf() with different unsigned formats from the above $format array
-// and with signed and other types of values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-?>
---EXPECT--
-*** Testing vsprintf() : unsigned formats and unsigned values ***
-
--- Iteration 1 --
-string(16) "1234567 342391 0"
-
--- Iteration 2 --
-string(23) "3755744308 u 1234 12345"
-
--- Iteration 3 --
-string(25) " 1234000 1012345 120"
-
--- Iteration 4 --
-string(10) "#1 0 $0 10"
-
--- Iteration 5 --
-string(7) "1 2 3 4"
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - unsigned formats with unsigned values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different unsigned formats and unsigned values
- * are passed to the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : unsigned formats and unsigned values ***\n";
-
-// defining array of unsigned formats
-$formats = array(
- '%u %+u %-u',
- '%lu %Lu %4u %-4u',
- '%10.4u %-10.4u %.4u',
- '%\'#2u %\'2u %\'$2u %\'_2u',
- '%3$u %4$u %1$u %2$u'
-);
-
-// Arrays of unsigned values for the format defined in $format.
-// Each sub array contains unsigned values which correspond to each format string in $format
-$args_array = array(
- array(1234567, 01234567, 0 ),
- array(12345678900, 12345678900, 1234, 12345),
- array("1234000", 10e20, 1.2e2),
- array(1, 0, 00, "10_"),
- array(3, 4, 1, 2)
-);
-
-// looping to test vsprintf() with different unsigned formats from the above $format array
-// and with signed and other types of values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : unsigned formats and unsigned values ***
-
--- Iteration 1 --
-string(16) "1234567 342391 0"
-
--- Iteration 2 --
-string(24) "12345678900 u 1234 12345"
-
--- Iteration 3 --
-string(34) " 1234000 3875820019684212736 120"
-
--- Iteration 4 --
-string(10) "#1 0 $0 10"
-
--- Iteration 5 --
-string(7) "1 2 3 4"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - unsigned formats with signed and other types of values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different unsigned formats and signed values and other types of values
- * are passed to the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : unsigned formats and signed & other types of values ***\n";
-
-// defining array of unsigned formats
-$formats =
- '%u %+u %-u
- %lu %Lu %4u %-4u
- %10.4u %-10.4u %.4u
- %\'#2u %\'2u %\'$2u %\'_2u
- %3$u %4$u %1$u %2$u';
-
-// Arrays of signed and other type of values for the format defined in $format.
-// Each sub array contains signed values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(+2.2, +.2, +10.2,
- +123456.234, +123456.234, +1234.6789,
- +2e10, +2e12, +22e+12,
- +12345.780, +12.000000011111, -12.00000111111, -123456.234,
- +3.33, +4.44, +1.11,-2.22 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different unsigned formats from the above $format array
-// and with signed and other types of values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : unsigned formats and signed & other types of values ***
-
--- Iteration 1 --
-string(113) "2 0 10
- 123456 u 1234 2820130816
- 2840207360 1177509888 12345
- 12 4294967284 4294843840 _3
- 10 123456 2 0"
-
--- Iteration 2 --
-string(86) "0 0 0
- 123 u 4294967173 123
- 0 0 0
- 1234 0 $0 _0
- 0 123 0 0"
-
--- Iteration 3 --
-string(74) "1 1 1
- 1 u 1 1
- 1 1 1
- #1 1 $1 _1
- 1 1 1 1"
-
--- Iteration 4 --
-string(74) "1 1 0
- 1 u 0 1
- 1 1 0
- #0 1 $1 _0
- 0 1 1 1"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - unsigned formats with signed and other types of values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different unsigned formats and signed values and other types of values
- * are passed to the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : unsigned formats and signed & other types of values ***\n";
-
-// defining array of unsigned formats
-$formats =
- '%u %+u %-u
- %lu %Lu %4u %-4u
- %10.4u %-10.4u %.4u
- %\'#2u %\'2u %\'$2u %\'_2u
- %3$u %4$u %1$u %2$u';
-
-// Arrays of signed and other type of values for the format defined in $format.
-// Each sub array contains signed values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(+2.2, +.2, +10.2,
- +123456.234, +123456.234, +1234.6789,
- +2e10, +2e12, +22e+12,
- +12345.780, +12.000000011111, -12.00000111111, -123456.234,
- +3.33, +4.44, +1.11,-2.22 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different unsigned formats from the above $format array
-// and with signed and other types of values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : unsigned formats and signed & other types of values ***
-
--- Iteration 1 --
-string(145) "2 0 10
- 123456 u 1234 20000000000
- 2000000000000 22000000000000 12345
- 12 18446744073709551604 18446744073709428160 _3
- 10 123456 2 0"
-
--- Iteration 2 --
-string(100) "0 0 0
- 123 u 18446744073709551493 123
- 0 0 0
- 1234 0 $0 _0
- 0 123 0 0"
-
--- Iteration 3 --
-string(78) "1 1 1
- 1 u 1 1
- 1 1 1
- #1 1 $1 _1
- 1 1 1 1"
-
--- Iteration 4 --
-string(78) "1 1 0
- 1 u 0 1
- 1 1 0
- #0 1 $1 _0
- 0 1 1 1"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - scientific formats with scientific values
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different scientific formats and scientific values
- * are passed to the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : scientific formats and scientific values ***\n";
-
-// defining array of scientific formats
-$formats = array(
- '%e %+e %-e',
- '%le %Le %4e %-4e',
- '%10.4e %-10.4e %.4e',
- '%\'#20e %\'20e %\'$20e %\'_20e',
- '%3$e %4$e %1$e %2$e'
-);
-
-// Arrays of scientific values for the format defined in $format.
-// Each sub array contains scientific values which correspond to each format string in $format
-$args_array = array(
- array(0, 1e0, "10e2" ),
- array(2.2e2, 10e10, 1000e-2, 1000e7),
- array(-22e12, 10e20, 1.2e2),
- array(1e1, +1e2, -1e3, "1e2_"),
- array(3e3, 4e3, 1e3, 2e3)
-);
-
-// looping to test vsprintf() with different scientific formats from the above $format array
-// and with signed and other types of values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : scientific formats and scientific values ***
-
--- Iteration 1 --
-string(36) "0.000000e+0 +1.000000e+0 1.000000e+3"
-
--- Iteration 2 --
-string(38) "2.200000e+2 e 1.000000e+1 1.000000e+10"
-
--- Iteration 3 --
-string(32) "-2.2000e+13 1.0000e+21 1.2000e+2"
-
--- Iteration 4 --
-string(74) "#########1.000000e+1 1.000000e+2 $$$$$$$$-1.000000e+3 _________1.000000e+2"
-
--- Iteration 5 --
-string(47) "1.000000e+3 2.000000e+3 3.000000e+3 4.000000e+3"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - scientific formats with non-scientific values
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different scientific formats and non-scientific values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : scientific formats and non-scientific values ***\n";
-
-// defining array of non-scientific formats
-$formats =
- '%e %+e %-e
- %le %Le %4e %-4e
- %10.4e %-10.4e %04e %04.4e
- %\'#2e %\'2e %\'$2e %\'_2e
- %3$e %4$e %1$e %2$e';
-
-// Arrays of non scientific values for the format defined in $format.
-// Each sub array contains non scientific values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 20.00, +212.2, -411000000000, 2212.000000000001,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different scientific formats from the above $format array
-// and with non-scientific values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : scientific formats and non-scientific values ***
-
--- Iteration 1 --
-string(231) "2.200000e+0 +2.000000e-1 1.020000e+1
- 1.234562e+5 e -1.234679e+3 1.234679e+3
- 2.0000e+1 2.1220e+2 -4.110000e+11 2.2120e+3
- 1.234578e+4 1.200000e+1 -1.200000e+1 -1.234562e+5
- 1.020000e+1 1.234562e+5 2.200000e+0 2.000000e-1"
-
--- Iteration 2 --
-string(227) "0.000000e+0 +0.000000e+0 0.000000e+0
- 1.230000e+2 e -1.230000e+2 1.230000e+2
- 0.0000e+0 0.0000e+0 1.234560e+5 0.0000e+0
- 1.234000e+3 0.000000e+0 0.000000e+0 0.000000e+0
- 0.000000e+0 1.230000e+2 0.000000e+0 0.000000e+0"
-
--- Iteration 3 --
-string(226) "1.000000e+0 +1.000000e+0 1.000000e+0
- 1.000000e+0 e 1.000000e+0 1.000000e+0
- 1.0000e+0 1.0000e+0 1.000000e+0 1.0000e+0
- 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0
- 1.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0"
-
--- Iteration 4 --
-string(226) "1.000000e+0 +1.000000e+0 0.000000e+0
- 1.000000e+0 e 0.000000e+0 1.000000e+0
- 1.0000e+0 0.0000e+0 1.000000e+0 0.0000e+0
- 0.000000e+0 1.000000e+0 1.000000e+0 0.000000e+0
- 0.000000e+0 1.000000e+0 1.000000e+0 1.000000e+0"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - with whitespaces in format strings
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string $format , array $args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-echo "*** Testing vsprintf() : with white spaces in format strings ***\n";
-
-// initializing the format array
-$formats = array(
- "% d % d % d",
- "% f % f % f",
- "% F % F % F",
- "% b % b % b",
- "% c % c % c",
- "% e % e % e",
- "% u % u % u",
- "% o % o % o",
- "% x % x % x",
- "% X % X % X",
- "% E % E % E"
-);
-
-// initializing the args array
-
-$args_array = array(
- array(111, 222, 333),
- array(1.1, .2, -0.6),
- array(1.12, -1.13, +0.23),
- array(1, 2, 3),
- array(65, 66, 67),
- array(2e1, 2e-1, -2e1),
- array(-11, +22, 33),
- array(012, -023, +023),
- array(0x11, -0x22, +0x33),
- array(0x11, -0x22, +0x33),
- array(2e1, 2e-1, -2e1)
-);
-
-$counter = 1;
-foreach($formats as $format) {
- echo"\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : with white spaces in format strings ***
-
--- Iteration 1 --
-string(13) "111 222 333"
-
--- Iteration 2 --
-string(29) "1.100000 0.200000 -0.600000"
-
--- Iteration 3 --
-string(29) "1.120000 -1.130000 0.230000"
-
--- Iteration 4 --
-string(9) "1 10 11"
-
--- Iteration 5 --
-string(7) "A B C"
-
--- Iteration 6 --
-string(38) "2.000000e+1 2.000000e-1 -2.000000e+1"
-
--- Iteration 7 --
-string(18) "4294967285 22 33"
-
--- Iteration 8 --
-string(19) "12 37777777755 23"
-
--- Iteration 9 --
-string(16) "11 ffffffde 33"
-
--- Iteration 10 --
-string(16) "11 FFFFFFDE 33"
-
--- Iteration 11 --
-string(38) "2.000000E+1 2.000000E-1 -2.000000E+1"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - with whitespaces in format strings
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string $format , array $args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-echo "*** Testing vsprintf() : with white spaces in format strings ***\n";
-
-// initializing the format array
-$formats = array(
- "% d % d % d",
- "% f % f % f",
- "% F % F % F",
- "% b % b % b",
- "% c % c % c",
- "% e % e % e",
- "% u % u % u",
- "% o % o % o",
- "% x % x % x",
- "% X % X % X",
- "% E % E % E"
-);
-
-// initializing the args array
-
-$args_array = array(
- array(111, 222, 333),
- array(1.1, .2, -0.6),
- array(1.12, -1.13, +0.23),
- array(1, 2, 3),
- array(65, 66, 67),
- array(2e1, 2e-1, -2e1),
- array(-11, +22, 33),
- array(012, -023, +023),
- array(0x11, -0x22, +0x33),
- array(0x11, -0x22, +0x33),
- array(2e1, 2e-1, -2e1)
-);
-
-$counter = 1;
-foreach($formats as $format) {
- echo"\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : with white spaces in format strings ***
-
--- Iteration 1 --
-string(13) "111 222 333"
-
--- Iteration 2 --
-string(29) "1.100000 0.200000 -0.600000"
-
--- Iteration 3 --
-string(29) "1.120000 -1.130000 0.230000"
-
--- Iteration 4 --
-string(9) "1 10 11"
-
--- Iteration 5 --
-string(7) "A B C"
-
--- Iteration 6 --
-string(38) "2.000000e+1 2.000000e-1 -2.000000e+1"
-
--- Iteration 7 --
-string(28) "18446744073709551605 22 33"
-
--- Iteration 8 --
-string(30) "12 1777777777777777777755 23"
-
--- Iteration 9 --
-string(24) "11 ffffffffffffffde 33"
-
--- Iteration 10 --
-string(24) "11 FFFFFFFFFFFFFFDE 33"
-
--- Iteration 11 --
-string(38) "2.000000E+1 2.000000E-1 -2.000000E+1"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - unexpected values for args argument
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different unexpected values are passed to
- * the '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : with unexpected values for args argument ***\n";
-
-// initialising the required variables
-$format = '%s';
-
-//get an unset variable
-$unset_var = 10;
-unset ($unset_var);
-
-// declaring a class
-class sample
-{
- public function __toString() {
- return "object";
- }
-}
-
-// Defining resource
-$file_handle = fopen(__FILE__, 'r');
-
-
-//array of values to iterate over
-$values = array(
-
- // int data
- 0,
- 1,
- 12345,
- -2345,
-
- // float data
- 10.5,
- -10.5,
- 10.1234567e10,
- 10.7654321E-10,
- .5,
-
- // null data
- NULL,
- null,
-
- // boolean data
- true,
- false,
- TRUE,
- FALSE,
-
- // empty data
- "",
- '',
-
- // string data
- "string",
- 'string',
-
- // object data
- new sample(),
-
- // undefined data
- @$undefined_var,
-
- // unset data
- @$unset_var,
-
- // resource data
- $file_handle
-);
-
-// loop through each element of the array for args
-$counter = 1;
-foreach($values as $value) {
- echo "\n-- Iteration $counter --\n";
- try {
- var_dump( vsprintf($format,$value) );
- } catch (\ValueError $e) {
- echo $e->getMessage(), "\n";
- }
- $counter++;
-};
-
-// closing the resource
-fclose($file_handle);
-
-echo "Done";
-?>
---EXPECTF--
-*** Testing vsprintf() : with unexpected values for args argument ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(1) "1"
-
--- Iteration 3 --
-string(5) "12345"
-
--- Iteration 4 --
-string(5) "-2345"
-
--- Iteration 5 --
-string(4) "10.5"
-
--- Iteration 6 --
-string(5) "-10.5"
-
--- Iteration 7 --
-string(12) "101234567000"
-
--- Iteration 8 --
-string(13) "1.07654321E-9"
-
--- Iteration 9 --
-string(3) "0.5"
-
--- Iteration 10 --
-The arguments array must contain 1 items, 0 given
-
--- Iteration 11 --
-The arguments array must contain 1 items, 0 given
-
--- Iteration 12 --
-string(1) "1"
-
--- Iteration 13 --
-string(0) ""
-
--- Iteration 14 --
-string(1) "1"
-
--- Iteration 15 --
-string(0) ""
-
--- Iteration 16 --
-string(0) ""
-
--- Iteration 17 --
-string(0) ""
-
--- Iteration 18 --
-string(6) "string"
-
--- Iteration 19 --
-string(6) "string"
-
--- Iteration 20 --
-The arguments array must contain 1 items, 0 given
-
--- Iteration 21 --
-The arguments array must contain 1 items, 0 given
-
--- Iteration 22 --
-The arguments array must contain 1 items, 0 given
-
--- Iteration 23 --
-string(%d) "Resource id #%d"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - int formats with int values
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different int formats and int values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : int formats with int values ***\n";
-
-
-// defining array of int formats
-$formats = array(
- "%d",
- "%+d %-d %D",
- "%ld %Ld, %4d %-4d",
- "%10.4d %-10.4d %04d %04.4d",
- "%'#2d %'2d %'$2d %'_2d",
- "%d %d %d %d",
- "% %%d d%",
- '%3$d %4$d %1$d %2$d'
-);
-
-// Arrays of int values for the format defined in $format.
-// Each sub array contains int values which correspond to each format string in $format
-$args_array = array(
- array(0),
- array(-1, 1, +22),
- array(2147483647, -2147483648, +2147483640, -2147483640),
- array(123456, 12345678, -1234567, 1234567),
- array(111, 2222, 333333, 44444444),
- array(0x123b, 0xfAb, 0123, 012),
- array(1234, -5678, 2345),
- array(3, 4, 1, 2)
-
-);
-
-// looping to test vsprintf() with different int formats from the above $format array
-// and with int values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : int formats with int values ***
-
--- Iteration 1 --
-string(1) "0"
-
--- Iteration 2 --
-string(5) "-1 1 "
-
--- Iteration 3 --
-string(36) "2147483647 d, 2147483640 -2147483640"
-
--- Iteration 4 --
-string(38) " 123456 12345678 -1234567 1234567"
-
--- Iteration 5 --
-string(24) "111 2222 333333 44444444"
-
--- Iteration 6 --
-string(15) "4667 4011 83 10"
-
--- Iteration 7 --
-string(8) "%-5678 d"
-
--- Iteration 8 --
-string(7) "1 2 3 4"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - int formats with non-integer values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 4) die("skip this test is for 32bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different int formats and non-int values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : int formats and non-integer values ***\n";
-
-// defining array of int formats
-$formats =
- '%d %+d %-d
- %ld %Ld %4d %-4d
- %10.4d %-10.4d %.4d %04.4d
- %\'#2d %\'2d %\'$2d %\'_2d
- %3$d %4$d %1$d %2$d';
-
-// Arrays of non int values for the format defined in $format.
-// Each sub array contains non int values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e5, 4e3, 22e+6,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different int formats from the above $format array
-// and with non-int values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : int formats and non-integer values ***
-
--- Iteration 1 --
-string(111) "2 +0 10
- 123456 d -1234 1234
- -1474836480 200000 4000 22000000
- 12345 12 -12 -123456
- 10 123456 2 0"
-
--- Iteration 2 --
-string(91) "0 +0 0
- 123 d -123 123
- 0 0 123456 0000
- 1234 0 $0 _0
- 0 123 0 0"
-
--- Iteration 3 --
-string(80) "1 +1 1
- 1 d 1 1
- 1 1 1 0001
- #1 1 $1 _1
- 1 1 1 1"
-
--- Iteration 4 --
-string(80) "1 +1 0
- 1 d 0 1
- 1 0 1 0000
- #0 1 $1 _0
- 0 1 1 1"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - int formats with non-integer values
---SKIPIF--
-<?php
-if (PHP_INT_SIZE != 8) die("skip this test is for 64bit platform only");
-?>
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different int formats and non-int values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : int formats and non-integer values ***\n";
-
-// defining array of int formats
-$formats =
- '%d %+d %-d
- %ld %Ld %4d %-4d
- %10.4d %-10.4d %.4d %04.4d
- %\'#2d %\'2d %\'$2d %\'_2d
- %3$d %4$d %1$d %2$d';
-
-// Arrays of non int values for the format defined in $format.
-// Each sub array contains non int values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, 123456.234, -1234.6789, +1234.6789,
- 2e10, +2e5, 4e3, 22e+6,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different int formats from the above $format array
-// and with non-int values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : int formats and non-integer values ***
-
--- Iteration 1 --
-string(111) "2 +0 10
- 123456 d -1234 1234
- 20000000000 200000 4000 22000000
- 12345 12 -12 -123456
- 10 123456 2 0"
-
--- Iteration 2 --
-string(91) "0 +0 0
- 123 d -123 123
- 0 0 123456 0000
- 1234 0 $0 _0
- 0 123 0 0"
-
--- Iteration 3 --
-string(80) "1 +1 1
- 1 d 1 1
- 1 1 1 0001
- #1 1 $1 _1
- 1 1 1 1"
-
--- Iteration 4 --
-string(80) "1 +1 0
- 1 d 0 1
- 1 0 1 0000
- #0 1 $1 _0
- 0 1 1 1"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - float formats with float values
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different float formats and float values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : int formats with float values ***\n";
-
-
-// defining array of float formats
-$formats = array(
- "%f",
- "%+f %-f %F",
- "%lf %Lf, %4f %-4f",
- "%10.4f %-10.4F %04f %04.4f",
- "%'#2f %'2f %'$2f %'_2f",
- "%f %f %f %f",
- "% %%f f%",
- '%3$f %4$f %1$f %2$f'
-);
-
-// Arrays of float values for the format defined in $format.
-// Each sub array contains float values which correspond to each format string in $format
-$args_array = array(
- array(0.0),
- array(-0.1, +0.1, +10.0000006),
- array(2147483649, -2147483647, +2147483640, -2147483640),
- array(2e5, 2e-5, -2e5, -2e-5),
- array(0.2E5, -0.2e40, 0.2E-20, 0.2E+20),
- array(0x123b, 0xfAb, 0123, 012),
- array(1234.1234, -5678.5678, 2345.2345),
- array(3.33, 4.44, 1.11, 2.22)
-
-);
-
-// looping to test vsprintf() with different float formats from the above $format array
-// and with float values from the above $args_array array
-$counter = 1;
-foreach($formats as $format) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($format, $args_array[$counter-1]) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : int formats with float values ***
-
--- Iteration 1 --
-string(8) "0.000000"
-
--- Iteration 2 --
-string(28) "-0.100000 0.100000 10.000001"
-
--- Iteration 3 --
-string(57) "2147483649.000000 f, 2147483640.000000 -2147483640.000000"
-
--- Iteration 4 --
-string(45) "200000.0000 0.0000 -200000.000000 -0.0000"
-
--- Iteration 5 --
-string(98) "20000.000000 -1999999999999999879418332743206357172224.000000 0.000000 20000000000000000000.000000"
-
--- Iteration 6 --
-string(43) "4667.000000 4011.000000 83.000000 10.000000"
-
--- Iteration 7 --
-string(15) "%-5678.567800 f"
-
--- Iteration 8 --
-string(35) "1.110000 2.220000 3.330000 4.440000"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - float formats with non-float values
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different float formats and non-float values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : float formats and non-float values ***\n";
-
-// defining array of float formats
-$formats =
- '%f %+f %-f
- %lf %Lf %4f %-4f
- %10.4f %-10.4f %04f %04.4f
- %\'#2f %\'2f %\'$2f %\'_2f
- %3$f %4$f %1$f %2$f';
-
-// Arrays of non float values for the format defined in $format.
-// Each sub array contains non float values which correspond to each format in $format
-$args_array = array(
-
- // array of int values
- array(2, -2, +2,
- 123456, 123456234, -12346789, +12346789,
- 123200, +20000, -40000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
- // array of strings
- array(" ", ' ', 'hello',
- '123hello', "123hello", '-123hello', '+123hello',
- "\12345678hello", "-\12345678hello", '0123456hello', 'h123456ello',
- "1234hello", "hello\0world", "NULL", "true",
- "3", "4", '1', '2'),
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('123'), array('-123'), array("-123"),
- array(true), array(false), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, 0, FALSE, 1,
- true, false, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different float formats from the above $format array
-// and with non-float values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-echo "Done";
-?>
---EXPECT--
-*** Testing vsprintf() : float formats and non-float values ***
-
--- Iteration 1 --
-string(243) "2.000000 -2.000000 2.000000
- 123456.000000 f -12346789.000000 12346789.000000
- 123200.0000 20000.0000 -40000.000000 22212.0000
- 12345780.000000 1211111.000000 -12111111.000000 -12345634.000000
- 2.000000 123456.000000 2.000000 -2.000000"
-
--- Iteration 2 --
-string(195) "0.000000 +0.000000 0.000000
- 123.000000 f -123.000000 123.000000
- 0.0000 0.0000 123456.000000 0.0000
- 1234.000000 0.000000 0.000000 0.000000
- 0.000000 123.000000 0.000000 0.000000"
-
--- Iteration 3 --
-string(178) "1.000000 +1.000000 1.000000
- 1.000000 f 1.000000 1.000000
- 1.0000 1.0000 1.000000 1.0000
- 1.000000 1.000000 1.000000 1.000000
- 1.000000 1.000000 1.000000 1.000000"
-
--- Iteration 4 --
-string(178) "1.000000 +1.000000 0.000000
- 1.000000 f 0.000000 1.000000
- 1.0000 0.0000 1.000000 0.0000
- 0.000000 1.000000 1.000000 0.000000
- 0.000000 1.000000 1.000000 1.000000"
-Done
+++ /dev/null
---TEST--
-Test vsprintf() function : usage variations - string formats with non-string values
---FILE--
-<?php
-/* Prototype : string vsprintf(string format, array args)
- * Description: Return a formatted string
- * Source code: ext/standard/formatted_print.c
-*/
-
-/*
- * Test vsprintf() when different string formats and non-string values are passed to
- * the '$format' and '$args' arguments of the function
-*/
-
-echo "*** Testing vsprintf() : string formats and non-string values ***\n";
-
-// defining array of string formats
-$formats =
- '%s %+s %-s
- %ls %4s %-4s
- %10.4s %-10.4s %04s %04.4s
- %\'#2s %\'2s %\'$2s %\'_2s
- %3$s %4$s %1$s %2$s';
-
-// Arrays of non string values for the format defined in $format.
-// Each sub array contains non string values which correspond to each format in $format
-$args_array = array(
-
- // array of float values
- array(2.2, .2, 10.2,
- 123456.234, -1234.6789, +1234.6789,
- 2.1234567e10, +2.7654321e10, -2.7654321e10, 2.1234567e10,
- 12345.780, 12.000000011111, -12.00000111111, -123456.234,
- 3.33, +4.44, 1.11,-2.22 ),
-
- // array of int values
- array(2, -2, +2,
- 123456, -12346789, +12346789,
- 123200, +20000, -40000, 22212,
- 12345780, 1211111, -12111111, -12345634,
- 3, +4, 1,-2 ),
-
-
- // different arrays
- array( array(0), array(1, 2), array(-1, -1),
- array("123"), array('-123'), array("-123"),
- array(true), array(false), array(TRUE), array(FALSE),
- array("123hello"), array("1", "2"), array('123hello'), array(12=>"12twelve"),
- array("3"), array("4"), array("1"), array("2") ),
-
- // array of boolean data
- array( true, TRUE, false,
- TRUE, FALSE, 1,
- true, false, TRUE, FALSE,
- 0, 1, 1, 0,
- 1, TRUE, 0, FALSE),
-
-);
-
-// looping to test vsprintf() with different string formats from the above $format array
-// and with non-string values from the above $args_array array
-$counter = 1;
-foreach($args_array as $args) {
- echo "\n-- Iteration $counter --\n";
- var_dump( vsprintf($formats, $args) );
- $counter++;
-}
-
-?>
---EXPECTF--
-*** Testing vsprintf() : string formats and non-string values ***
-
--- Iteration 1 --
-string(177) "2.2 0.2 10.2
- 123456.234 -1234.6789 1234.6789
- 2123 2765 -27654321000 2123
- 12345.78 12.000000011111 -12.00000111111 -123456.234
- 10.2 123456.234 2.2 0.2"
-
--- Iteration 2 --
-string(133) "2 -2 2
- 123456 -12346789 12346789
- 1232 2000 -40000 2221
- 12345780 1211111 -12111111 -12345634
- 2 123456 2 -2"
-
--- Iteration 3 --
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-
-Warning: Array to string conversion in %s on line %d
-string(132) "Array Array Array
- Array Array Array
- Arra Arra Array Arra
- Array Array Array Array
- Array Array Array Array"
-
--- Iteration 4 --
-string(82) "1 1
- 1 1
- 1 0001 0000
- #0 1 $1 _0
- 1 1 1"