# Using call_user_function with closures

- Thread: https://externals.io/message/48358
- Original archive: https://news-web.php.net/php.internals/48358
- Started by Alec on 2010-05-19T21:48:41+00:00
- Messages: 2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #48358 — Alec — 2010-05-19T21:48:41+00:00

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

I am taking over an extension from one of my coworkers, and it was 
written before the time of PHP 5.3. Are there any special considerations 
to think about when using closures with call_user_function? This is the 
current line:

if (call_user_function(EG(function_table), NULL, &callback, 
&local_retval, 1, argsv TSRMLS_CC ) == FAILURE)  {

However, when the extension is loaded, it crashes on this line when 
callback is a closure. When callback is a string (a userspace function 
name), everything works fine.

Thanks,
Alec

---

## #48359 — spam@geleia.net — 2010-05-19T23:22:42+00:00

URL: https://externals.io/message/48358#48359 · In reply to: #48358

> I am taking over an extension from one of my coworkers, and it was
> written before the time of PHP 5.3. Are there any special considerations to
> think about when using closures with call_user_function? This is the
> current line:
>
> if (call_user_function(EG(function_table), NULL, &callback, &local_retval,
> 1, argsv TSRMLS_CC ) == FAILURE)  {
>
>
> However, when the extension is loaded, it crashes on this line when
> callback is a closure. When callback is a string (a userspace function
> name), everything works fine.
>

I suppose that also doesn't work with callbacks with methods.

You may find this thread in pecl-dev useful:
http://marc.info/?t=127186855100001&r=1&w=2

-- 
Gustavo Lopes
