--TEST-- Test array_pad() function : usage variations - unexpected values for 'pad_size' argument(Bug#43482) --FILE-- 'red', 'item' => 'pen'), // null data /*11*/ NULL, null, // boolean data /*13*/ true, false, TRUE, FALSE, // empty data /*17*/ "", '', // string data /*19*/ "string", 'string', // object data /*21*/ new classA(), // undefined data /*22*/ @$undefined_var, // unset data /*23*/ @$unset_var, ); // loop through each element of $pad_sizes to check the behavior of array_pad() $iterator = 1; foreach($pad_sizes as $pad_size) { echo "-- Iteration $iterator --\n"; var_dump( array_pad($input, $pad_size, $pad_value) ); $iterator++; }; echo "Done"; ?> --EXPECTF-- *** Testing array_pad() : passing non integer values to $pad_size argument *** -- Iteration 1 -- array(10) { [0]=> int(1) [1]=> int(2) [2]=> int(1) [3]=> int(1) [4]=> int(1) [5]=> int(1) [6]=> int(1) [7]=> int(1) [8]=> int(1) [9]=> int(1) } -- Iteration 2 -- array(10) { [0]=> int(1) [1]=> int(1) [2]=> int(1) [3]=> int(1) [4]=> int(1) [5]=> int(1) [6]=> int(1) [7]=> int(1) [8]=> int(1) [9]=> int(2) } -- Iteration 3 -- Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d bool(false) -- Iteration 4 -- Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d bool(false) -- Iteration 5 -- array(2) { [0]=> int(1) [1]=> int(2) } -- Iteration 6 -- array(2) { [0]=> int(1) [1]=> int(2) } -- Iteration 7 -- Warning: array_pad() expects parameter 2 to be long, array given in %s on line %d NULL -- Iteration 8 -- Warning: array_pad() expects parameter 2 to be long, array given in %s on line %d NULL -- Iteration 9 -- Warning: array_pad() expects parameter 2 to be long, array given in %s on line %d NULL -- Iteration 10 -- Warning: array_pad() expects parameter 2 to be long, array given in %s on line %d NULL -- Iteration 11 -- Warning: array_pad() expects parameter 2 to be long, array given in %s on line %d NULL -- Iteration 12 -- array(2) { [0]=> int(1) [1]=> int(2) } -- Iteration 13 -- array(2) { [0]=> int(1) [1]=> int(2) } -- Iteration 14 -- array(2) { [0]=> int(1) [1]=> int(2) } -- Iteration 15 -- array(2) { [0]=> int(1) [1]=> int(2) } -- Iteration 16 -- array(2) { [0]=> int(1) [1]=> int(2) } -- Iteration 17 -- array(2) { [0]=> int(1) [1]=> int(2) } -- Iteration 18 -- Warning: array_pad() expects parameter 2 to be long, string given in %s on line %d NULL -- Iteration 19 -- Warning: array_pad() expects parameter 2 to be long, string given in %s on line %d NULL -- Iteration 20 -- Warning: array_pad() expects parameter 2 to be long, string given in %s on line %d NULL -- Iteration 21 -- Warning: array_pad() expects parameter 2 to be long, string given in %s on line %d NULL -- Iteration 22 -- Warning: array_pad() expects parameter 2 to be long, object given in %s on line %d NULL -- Iteration 23 -- array(2) { [0]=> int(1) [1]=> int(2) } -- Iteration 24 -- array(2) { [0]=> int(1) [1]=> int(2) } Done