Skip to content

HashTableIterators of empty hashtables are not poisoned upon destruction #8438

@bwoebi

Description

@bwoebi

Description

Using the zend_hash_iterators_* API, non-empty arrays are properly marked as poisoned in the HashTableIterator entries when destroyed.

However there is an edge case: if nNumUsed == 0 (thanks to deletion of entries during iteration), then the zend_hash_iterators_remove call is skipped in zend_hash_destroy.

Thus, we either should:
a) fix this by always calling the removal ... or
b) completely remove the auto-removal on destruction and leave it the extension authors responsibility to clear the iterators (making zend_hash_iterators_remove public API)

From the perspective of the code in php-src there is no need to have the auto-removal on free, as every iterating thing holds a reference to it.

PHP Version

master

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions