com php-src: reverted changes for #62477: NEWS ext/spl/spl_it erators.c ext/spl/spl_iterators.h ext/spl/tests/bug 62477_1.phpt ext/spl/tests/bug62477
_2.phpt
| From: | Anatoliy Belsky | Date: | Thu, 12 Jul 2012 08:54:14 +0000 |
| Subject: | com php-src: reverted changes for #62477: NEWS ext/spl/spl_it erators.c ext/spl/spl_iterators.h ext/spl/tests/bug 62477_1.phpt ext/spl/tests/bug62477 _2.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-69571@lists.php.net to get a copy of this message | ||
Commit: ad7eeba3c1a4c77f439afc936fbf50b811a46a6b
Author: Anatoliy Belsky <ab@php.net> Thu, 12 Jul 2012 10:54:14 +0200
Parents: 896d0fcd41df13fc852417de222aac2482d2704b
Branches: PHP-5.3 PHP-5.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ad7eeba3c1a4c77f439afc936fbf50b811a46a6b
Log:
reverted changes for #62477
Bugs:
https://bugs.php.net/62477
Changed paths:
M NEWS
M ext/spl/spl_iterators.c
M ext/spl/spl_iterators.h
D ext/spl/tests/bug62477_1.phpt
D ext/spl/tests/bug62477_2.phpt
Diff:
diff --git a/NEWS b/NEWS
index 2f60c43..902185c 100644
--- a/NEWS
+++ b/NEWS
@@ -204,7 +204,6 @@ PHP NEWS
having had its dtor callback called in between). (Gustavo)
. Fixed bug #61347 (inconsistent isset behavior of Arrayobject). (Laruence)
. Fixed bug #61326 (ArrayObject comparison). (Gustavo)
- . Fixed bug #62477 LimitIterator int overflow. (Anatoliy)
- SQLite3 extension:
. Add createCollation() method. (Brad Dewar)
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 1cbb2e4..eecd483 100755
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1380,31 +1380,12 @@ static spl_dual_it_object*
spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
intern->dit_type = dit_type;
switch (dit_type) {
case DIT_LimitIterator: {
- zval *tmp_offset, *tmp_count;
intern->u.limit.offset = 0; /* start at beginning */
intern->u.limit.count = -1; /* get all */
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|zz", &zobject, ce_inner,
&tmp_offset, &tmp_count) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O|ll", &zobject, ce_inner,
&intern->u.limit.offset, &intern->u.limit.count) == FAILURE) {
zend_restore_error_handling(&error_handling TSRMLS_CC);
return NULL;
}
- if (tmp_offset && Z_TYPE_P(tmp_offset) != IS_NULL) {
- if (Z_TYPE_P(tmp_offset) != IS_LONG) {
- zend_throw_exception(spl_ce_OutOfRangeException, "offset param must be of type int",
0 TSRMLS_CC);
- zend_restore_error_handling(&error_handling TSRMLS_CC);
- return NULL;
- } else {
- intern->u.limit.offset = Z_LVAL_P(tmp_offset);
- }
- }
- if (tmp_count && Z_TYPE_P(tmp_count) != IS_NULL) {
- if (Z_TYPE_P(tmp_count) != IS_LONG) {
- zend_throw_exception(spl_ce_OutOfRangeException, "count param must be of type int",
0 TSRMLS_CC);
- zend_restore_error_handling(&error_handling TSRMLS_CC);
- return NULL;
- } else {
- intern->u.limit.count = Z_LVAL_P(tmp_count);
- }
- }
if (intern->u.limit.offset < 0) {
zend_throw_exception(spl_ce_OutOfRangeException, "Parameter offset must be >= 0",
0 TSRMLS_CC);
zend_restore_error_handling(&error_handling TSRMLS_CC);
diff --git a/ext/spl/spl_iterators.h b/ext/spl/spl_iterators.h
index 9494b26..525a25c 100755
--- a/ext/spl/spl_iterators.h
+++ b/ext/spl/spl_iterators.h
@@ -128,7 +128,7 @@ typedef struct _spl_dual_it_object {
uint str_key_len;
ulong int_key;
int key_type; /* HASH_KEY_IS_STRING or HASH_KEY_IS_LONG */
- long pos;
+ int pos;
} current;
dual_it_type dit_type;
union {
diff --git a/ext/spl/tests/bug62477_1.phpt b/ext/spl/tests/bug62477_1.phpt
deleted file mode 100644
index 1b768a7..0000000
--- a/ext/spl/tests/bug62477_1.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Bug #62477 LimitIterator int overflow when float is passed (1)
---FILE--
-<?php
-
-$it = new LimitIterator(new ArrayIterator(array(42)), 10000000000000000000);
---EXPECTF--
-Fatal error: Uncaught exception 'OutOfRangeException' with message 'offset param
must be of type int' in %sbug62477_1.php:%d
-Stack trace:
-#0 %sbug62477_1.php(%d): LimitIterator->__construct(Object(ArrayIterator), %f)
-#1 {main}
- thrown in %sbug62477_1.php on line %d
diff --git a/ext/spl/tests/bug62477_2.phpt b/ext/spl/tests/bug62477_2.phpt
deleted file mode 100644
index aa3468a..0000000
--- a/ext/spl/tests/bug62477_2.phpt
+++ /dev/null
@@ -1,12 +0,0 @@
---TEST--
-Bug #62477 LimitIterator int overflow when float is passed (2)
---FILE--
-<?php
-
-$it = new LimitIterator(new ArrayIterator(array(42)), 0, 10000000000000000000);
---EXPECTF--
-Fatal error: Uncaught exception 'OutOfRangeException' with message 'count param must
be of type int' in %sbug62477_2.php:%d
-Stack trace:
-#0 %sbug62477_2.php(%d): LimitIterator->__construct(Object(ArrayIterator), 0, %f)
-#1 {main}
- thrown in %sbug62477_2.php on line %d