#43482 [Fbk->Csd]: Inconsistent behavior in array_pad() function.
| From: | iliaa@php.net | Date: | Mon, 03 Dec 2007 14:13:56 +0000 |
| Subject: | #43482 [Fbk->Csd]: Inconsistent behavior in array_pad() function. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-120314@lists.php.net to get a copy of this message | ||
ID: 43482
Updated by: iliaa@php.net
Reported By: dharma dot yp at in dot ibm dot com
-Status: Feedback
+Status: Closed
Bug Type: Arrays related
Operating System: Linux
PHP Version: 5.2CVS-2007-12-03 (snap)
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2007-12-03 13:45:52] iliaa@php.net
Are you running the test on 32 bit system by any chance?
------------------------------------------------------------------------
[2007-12-03 13:45:14] iliaa@php.net
Works fine in CVS, I've just tried it, both 5.3 and 5.2 return FALSE +
warning in both cases.
------------------------------------------------------------------------
[2007-12-03 11:07:19] 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)
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43482&edit=1