mirror of
https://github.com/macintoshplus/mongo-php-driver.git
synced 2026-03-31 21:32:14 +02:00
When a numeric array was encoded to BSON, the hash's apply counter was incremented and decremented irrespective of whether apply protection was enabled. This was not compatible with immutable arrays, which may be created by OPcache. We now consult ZEND_HASH_APPLY_PROTECTION() whenever an apply counter might be modified. Previously, object_to_bson() incremented the apply counter when converting a MongoDB\BSON\Type instance. Associative arrays and other objects were not protected. This patch adds recursion checking for those types. Since PHP7 already has macros for working with the apply counter, this patch adds equivalent macros for PHP 5.x.