I believe, I sorted out most of the issues. Now, the last problem: what is the official way to deep-copy non-persistent zval into persistent zval?
I expected zval_copy_ctor to have a flag. Unfortunately, it doesn't have one. the way I see it: void zval_copy_ctor(zval *value, zend_bool persistent) such declaration would break compatibility, so, probably, there's a need to introduce zval_pcopy_ctor(zval *value, zend_bool persistent) { //… } and #define zval_copy_ctor(v) zval_pcopy_ctor(v, 0) similiar to how it is done with *alloc functions -- Alexey Zakhlestin http://blog.milkfarmsoft.com/