Inconsistent behavior in array_pad() function.
| Bug #43482 | Inconsistent behavior in array_pad() function. | ||||
|---|---|---|---|---|---|
| Submitted: | 2007-12-03 11:07 UTC | Modified: | 2007-12-03 14:13 UTC | ||
| From: | dharma dot yp at in dot ibm dot com | Assigned: | |||
| Status: | Closed | Package: | Arrays related | ||
| PHP Version: | 5.2CVS-2007-12-03 (snap) | OS: | Linux | ||
| Private report: | No | CVE-ID: | None | ||
[2007-12-03 11:07 UTC] dharma dot yp at in dot ibm dot com
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)
}
Patches
Pull Requests
History
AllCommentsChangesGit/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