Skip to content

zend_objects_API: Assert that the .offset is correct in zend_object_alloc() - #23101

Draft
TimWolla wants to merge 2 commits into
php:masterfrom
TimWolla:zend-objects-new-use-zend-object-alloc
Draft

zend_objects_API: Assert that the .offset is correct in zend_object_alloc()#23101
TimWolla wants to merge 2 commits into
php:masterfrom
TimWolla:zend-objects-new-use-zend-object-alloc

Conversation

@TimWolla

@TimWolla TimWolla commented Aug 7, 2026

Copy link
Copy Markdown
Member

Motivation is that I initially didn't implement the .clone_obj handler for Time\Duration, since I thought I didn't need it (since I don't have allocated data there and a simple memcpy of the extra data would suffice), which lead to an obscure error in ZendMM due to pointer alignment.

…t_alloc()`

This makes mistakes like setting an incorrect `.offset` for the object handlers
or forgetting to implement `create_object` and `clone_obj` when specifying an
offset easier to debug.
@TimWolla
TimWolla requested a review from arnaud-lb August 7, 2026 14:08
@TimWolla
TimWolla requested a review from dstogov as a code owner August 7, 2026 14:08
@TimWolla
TimWolla marked this pull request as draft August 7, 2026 15:14
@Girgias

Girgias commented Aug 7, 2026

Copy link
Copy Markdown
Member

I guess custom objects don't follow this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants