From: dharma dot yp at in dot ibm dot com
Operating system: Linux
PHP version: 5.2CVS-2007-12-03 (snap)
PHP Bug Type: Arrays related
Bug description: Inconsistent behavior in array_pad() function.
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)
}
--
Edit bug report at http://bugs.php.net/?id=43482&edit=1
--
Try a CVS snapshot (PHP 4.4):
http://bugs.php.net/fix.php?id=43482&r=trysnapshot44
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=43482&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=43482&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=43482&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=43482&r=fixedcvs
Fixed in release:
http://bugs.php.net/fix.php?id=43482&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=43482&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=43482&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=43482&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=43482&r=support
Expected behavior: http://bugs.php.net/fix.php?id=43482&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=43482&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=43482&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=43482&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43482&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=43482&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=43482&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=43482&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=43482&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=43482&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=43482&r=mysqlcfg