|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-12-03 13:45 UTC] iliaa@php.net
[2007-12-03 13:45 UTC] iliaa@php.net
[2007-12-03 14:13 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 05:00:02 2025 UTC |
Description: ------------ When a negative value of -12345678900 is passed for pad_size argument of array_pad(), the function doesn't produce a warning in Linux environment but a warning message is output on Windows. Whereas, when a positive value of the above, i.e. 12345678900 is passed for pad_size argument, warning message is output on both Linux and windows. This behavior is observed in the testcase array_pad_variation2.phpt on Linux environment. Could you explain the reason behind this inconsistent behavior. This is applicable to PHP5.3 and PHP6 as well. Reproduce code: --------------- <?php $arr = array(1); var_dump( array_pad($arr, 12345678900, "hello") ); // warning generated var_dump( array_pad($arr, -12345678900, "hello") ); // no warning ?> Expected result: ---------------- Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d bool(false) Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d bool(false) Actual result: -------------- Warning: array_pad(): You may only pad up to 1048576 elements at a time in %s on line %d bool(false) array(1) { [0]=> int(1) }