# Should the engine be able to pass variables by reference of userland functions

- Thread: https://externals.io/message/118847
- Original archive: https://news-web.php.net/php.internals/118847
- Started by G. P. B. on 2022-10-19T14:27:33+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #118847 — G. P. B. — 2022-10-19T14:27:33+00:00

URL: https://externals.io/message/118847#118847

Hello internals,

While working on cleaning up the FCI/FCC API I stumbled upon the
zend_fcall_info_args_ex()
function.
This function allows the engine to pass "variables" to userland functions
that expect a by-ref parameter.
This is currently only used within php-src in PDO when calling the
constructor of classes where the result of a statement should be stored in
PDO::FETCH_CLASS mode.

I am wondering if this makes any sense to continue support in general, and
thus in this specific case. As every other engine call to userland function
passes by value.

A PR of this change is located:
https://github.com/php/php-src/pull/9725/files

What are your opinions?

Best regards,

George P. Banyard

---

## #118848 — Kamil Tekiela — 2022-10-19T14:37:23+00:00

URL: https://externals.io/message/118847#118848 · In reply to: #118847

Hi,

I am not sure if we should still support it. But I don't think it's
unthinkable to expect such feature from PHP. However, personally, I don't
find pass-by-ref that useful in general. The question is whether this
feature is used a lot in the wild.

If we decide to drop support for this, it should probably go through a
deprecation phase.

Regards,
Kamil

---

## #118849 — Jordan LeDoux — 2022-10-19T16:58:12+00:00

URL: https://externals.io/message/118847#118849 · In reply to: #118848

> Hi,
>
> I am not sure if we should still support it. But I don't think it's
> unthinkable to expect such feature from PHP. However, personally, I don't
> find pass-by-ref that useful in general. The question is whether this
> feature is used a lot in the wild.
>
> If we decide to drop support for this, it should probably go through a
> deprecation phase.
>
> Regards,
> Kamil
>

Pass by-ref is used a LOT in the wild, but I didn't interpret George's
question as "should we remove pass by-ref from userland entirely". Surely
the engine also supports pass by-ref somewhere in the VM as well as the
place that was mentioned, it just does it in a different way?

Jordan
