feat(extgen): add support for arrays as parameters and return types by alexandre-daubois · Pull Request #1724 · php/frankenphp

Exciting times! My only concern is that we're passing zvals. How does that impact GC on the PHP side? Do we need to update the ref-counts of the zval? For example, if I have the following code:

function foo() {
  // set a global in the extension, the value will be gc'd upon return
  set_my_ext_global([]);
}

foo();
var_dump(get_my_ext_global());

In this case, we won't have a memory leak (the original [] gets destroyed), and we actually get a deep copy later? Or, is there a reference still to [] hanging around?