diff options
author | Gustavo André dos Santos Lopes <cataphract@php.net> | 2012-03-23 09:42:05 +0000 |
---|---|---|
committer | Gustavo André dos Santos Lopes <cataphract@php.net> | 2012-03-23 11:19:19 +0000 |
commit | 3960def881c5e29daa18c914cf95e1e978db053b (patch) | |
tree | 82527bbfe2b662a145addae50d4fea9fe4702a70 /ext/dom/php_dom.c | |
parent | 85725337d5aa7d6cbe69be8c4ce83656f0aca885 (diff) | |
download | php-git-3960def881c5e29daa18c914cf95e1e978db053b.tar.gz |
Fixed bug #61482, caused by the fix to bug #61418.
Turns out I'd forgotten to also update the destructor for the iterator
returned by DirectoryIterator.
The iterator for DirectoryIterator maintains the same ->current pointer
throughout its existence (the DirectoryIterator itself) and returns it
(the same object) everytime a value is requested from the iterator.
Moving forward the iterator only changes the object. Previous code
added two references to the object in get_iterator on the account of
1) the iterator memory living in its DirectoryIterator object and
2) the object being stored in iterator->current. This seems to be
unnecessary. Iterators are not responsible for incrementing the refcount
of the values they yield, that's up to the caller (the engine). What
matters for the iterator is that the object exists as long as the
iterator exists and this can be guaranteed by incremented the refcount
only once. Consequently, I only add one reference in get_iterator
(and reclaim it in the iterator destructor).
Diffstat (limited to 'ext/dom/php_dom.c')
0 files changed, 0 insertions, 0 deletions