History log of /PHP-8.4/Zend/zend_lazy_objects.c (Results 1 – 8 of 8)
Revision Date Author Comments
# 64081d13 11-Sep-2024 Arnaud Le Blanc

Lazy objects: Update class constants earlier

If a lazy object is created for a class whose constants can not be updated, then
we have created an instance of a non-instantiable class. Thi

Lazy objects: Update class constants earlier

If a lazy object is created for a class whose constants can not be updated, then
we have created an instance of a non-instantiable class. This breaks the
expectations of clone.

Here I ensure that a class has its constants updated before creating a lazy
instance of it.

Fixes OSS-Fuzz #71407
Closes GH-15856

show more ...


# c9dfb774 03-Oct-2024 Arnaud Le Blanc

Deny resetting an object as lazy during property iteration

Supporting object reset while its properties are being iterated would increase
complexity for little benefit. Furthermore it ma

Deny resetting an object as lazy during property iteration

Supporting object reset while its properties are being iterated would increase
complexity for little benefit. Furthermore it may not be possible to ensure a
consistent behavior between ghosts and proxies (wrt to iteration position).

Iteration is detected by checking if the object's properties ht has iterators.
This requires refactoring the hooked get_iterator() implementation to ensure
that it creates a properties ht iterator immediately.

Closes GH-15960

show more ...


# 52fec695 03-Oct-2024 Arnaud Le Blanc

Do not null out obj->properties when resetting object

Engine expects the properties ht to be separated, assigned a new ht, or resized,
but never to be nulled.


# ab72fbad 02-Oct-2024 Arnaud Le Blanc

Fix use-after-free during lazy object initialization (#16004)


# ea297654 24-Sep-2024 DanielEScherzer

Zend/*: fix a bunch of typos (GH-16017)

* Zend/*: fix a bunch of typos

* Zend/tests/try/try_catch_finally_005.phpt: update string length


# cc065bae 23-Sep-2024 Arnaud Le Blanc

Fix zend_lazy_object_get_properties for object with prop ht, when init fails (#15825)

zend_lazy_object_get_properties() is used by zend_std_get_properties_ex() to fetch the properties of laz

Fix zend_lazy_object_get_properties for object with prop ht, when init fails (#15825)

zend_lazy_object_get_properties() is used by zend_std_get_properties_ex() to fetch the properties of lazy objects. It initializes the object and returns its properties.

When initialization fails we return an empty ht because most callers do not check for NULL. We rely on the exception thrown during initialization. We also assign that empty ht to zend_object.properties for the same reasons.

We asserted that zend_object.properties was either NULL or &zend_empty_array, but there are other cases in which a uninitialized lazy object may have a properties ht.

Here I remove the assertion, and return the existing properties ht if there is one. Otherwise I return zend_new_array(0) instead of &zend_emtpy_array as not all callers expect an immutable array (e.g. FE_FETCH does not).

show more ...


# c65e042c 16-Sep-2024 Arnaud Le Blanc

Fix zend_get_property_info_for_slot() for lazy objects (#15855)

zend_get_property_info_for_slot(obj, slot) assumes that 'slot' belongs to 'obj', but that may not be the case for lazy proxies

Fix zend_get_property_info_for_slot() for lazy objects (#15855)

zend_get_property_info_for_slot(obj, slot) assumes that 'slot' belongs to 'obj', but that may not be the case for lazy proxies.

Fortunately, the property info is often already available in path when it is needed.

For other cases, I make zend_get_property_info_for_slot() aware of lazy objects, and add zend_get_property_info_for_slot_self() for cases where the 'slot' is known to belong to the object itself.

Fixes oss-fuzz #71446

show more ...


# 58aa6fc8 19-May-2023 Arnaud Le Blanc

Lazy objects

RFC: https://wiki.php.net/rfc/lazy-objects

Closes GH-15019