Patch abs for Arrays related Bug #64109
Patch version 2013-01-30 21:34 UTC
Return to Bug #64109 |
Download this patch
Patch Revisions:
Developer: xi.wang@gmail.com
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 40a27c0..aa674a6 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2636,13 +2636,13 @@ PHP_FUNCTION(array_pad)
}
/* Do some initial calculations */
- input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
- pad_size_abs = abs(pad_size);
- if (pad_size_abs < 0) {
+ if (pad_size == LONG_MIN) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "You may only pad up to 1048576 elements at a time");
zval_dtor(return_value);
RETURN_FALSE;
}
+ pad_size_abs = abs(pad_size);
+ input_size = zend_hash_num_elements(Z_ARRVAL_P(input));
do_pad = (input_size >= pad_size_abs) ? 0 : 1;
/* Copy the original array */
|