diff options
author | Arnaud Le Blanc <lbarnaud@php.net> | 2008-09-09 19:44:15 +0000 |
---|---|---|
committer | Arnaud Le Blanc <lbarnaud@php.net> | 2008-09-09 19:44:15 +0000 |
commit | 506e49c6e1c8d1f91dbba936d0e165b62278a3ed (patch) | |
tree | 092216631f4d62bd2d7e10af7eab85417e52318b /ext/spl | |
parent | bbb083fa24083bd8a3cc959f51106c592e50be16 (diff) | |
download | php-git-506e49c6e1c8d1f91dbba936d0e165b62278a3ed.tar.gz |
MFH: Fixed bug #46031 (Segfault in AppendIterator::next)
Diffstat (limited to 'ext/spl')
-rwxr-xr-x | ext/spl/spl_iterators.c | 3 | ||||
-rw-r--r-- | ext/spl/tests/bug46031.phpt | 9 |
2 files changed, 12 insertions, 0 deletions
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c index 10426c3192..f9111dba3c 100755 --- a/ext/spl/spl_iterators.c +++ b/ext/spl/spl_iterators.c @@ -1445,6 +1445,9 @@ static inline void spl_dual_it_rewind(spl_dual_it_object *intern TSRMLS_DC) static inline int spl_dual_it_valid(spl_dual_it_object *intern TSRMLS_DC) { + if (!intern->inner.iterator) { + return FAILURE; + } /* FAILURE / SUCCESS */ return intern->inner.iterator->funcs->valid(intern->inner.iterator TSRMLS_CC); } diff --git a/ext/spl/tests/bug46031.phpt b/ext/spl/tests/bug46031.phpt new file mode 100644 index 0000000000..9261ff0fe6 --- /dev/null +++ b/ext/spl/tests/bug46031.phpt @@ -0,0 +1,9 @@ +--TEST-- +Bug #46031 (Segfault in AppendIterator::next) +--FILE-- +<?php +$x = new AppendIterator(); +var_dump($x->next()); +?> +--EXPECT-- +NULL |