Skip to content

Commit 8f221bd

Browse files
committed
Fixed bug #76367 (NoRewindIterator segfault 11)
1 parent 68c3d09 commit 8f221bd

File tree

3 files changed

+20
-1
lines changed

3 files changed

+20
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ PHP NEWS
1212
. Fixed bug #76174 (openssl extension fails to build with LibreSSL 2.7).
1313
(Jakub Zelenka)
1414

15+
- SPL:
16+
. Fixed bug #76367 (NoRewindIterator segfault 11). (Laruence)
17+
1518
- Standard:
1619
. Fixed bug #76335 ("link(): Bad file descriptor" with non-ASCII path).
1720
(Anatol)

ext/spl/spl_array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ static zval *spl_array_it_get_current_data(zend_object_iterator *iter) /* {{{ */
10391039
return zend_user_it_get_current_data(iter);
10401040
} else {
10411041
zval *data = zend_hash_get_current_data_ex(aht, spl_array_get_pos_ptr(aht, object));
1042-
if (Z_TYPE_P(data) == IS_INDIRECT) {
1042+
if (data && Z_TYPE_P(data) == IS_INDIRECT) {
10431043
data = Z_INDIRECT_P(data);
10441044
}
10451045
return data;

ext/spl/tests/bug76367.phpt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--TEST--
2+
Bug #76367 (NoRewindIterator segfault 11)
3+
--FILE--
4+
<?php
5+
$arr = [1,3,55,66,43,6];
6+
7+
$iter = new NoRewindIterator(new ArrayIterator($arr));
8+
9+
while($iter->valid()) {
10+
$iter->next();
11+
}
12+
13+
var_dump($iter->current());
14+
?>
15+
--EXPECT--
16+
NULL

0 commit comments

Comments
 (0)