# Reflection API r1.136

- Thread: https://externals.io/message/13679
- Original archive: https://news-web.php.net/php.internals/13679
- Started by Timm Friebe on 2004-11-02T11:11:22+00:00
- Messages: 5
- 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

---

## #13679 — Timm Friebe — 2004-11-02T11:11:22+00:00

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

revision 1.136
date: 2004/10/31 15:30:53;  author: helly;  state: Exp;  lines: +163 -1
- Add ReflectionFunction::invokeArgs(array)
- Add ReflectionMethod::invokeArgs(obj, array)

Why was this added?

These:

1) call_user_func_array(
     array(new ReflectionMethod('class', 'method'), 'invoke',
     array(1, 2, 3)
   )

2) call_user_func(
     array(new ReflectionMethod('class', 'method'), 'invoke',
     1, 2, 3
   )

work just fine. Do we really need to duplicate code where a solution
already exists?

- Timm

---

## #13681 — Sebastian Bergmann — 2004-11-02T12:52:14+00:00

URL: https://externals.io/message/13679#13681 · In reply to: #13679

Timm Friebe wrote:
> Why was this added?

 I asked Marcus to add these.

> These:
> 
> 1) call_user_func_array(
>      array(new ReflectionMethod('class', 'method'), 'invoke',
>      array(1, 2, 3)
>    )
> 
> 2) call_user_func(
>      array(new ReflectionMethod('class', 'method'), 'invoke',
>      1, 2, 3
>    )
> 
> work just fine.

 They work, but not seamless.

-- 
Sebastian Bergmann                      http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

---

## #13686 — Timm Friebe — 2004-11-02T13:35:28+00:00

URL: https://externals.io/message/13679#13686 · In reply to: #13681

> Timm Friebe wrote:
> > […]
> 
>  I asked Marcus to add these.

He forgot to support invokeArgs(NULL, array(...)) for static invocation
("Warning: invokeArgs() expects parameter 1 to be object, null given").

[...call_user_func* equivalents...]
>  They work, but not seamless.

Care to elaborate? Except for the call_user_func-syntax being longer I
don't see any difference.

- Timm

---

## #13691 — Sebastian Bergmann — 2004-11-02T22:45:18+00:00

URL: https://externals.io/message/13679#13691 · In reply to: #13686

Timm Friebe wrote:
> Care to elaborate? Except for the call_user_func-syntax being longer I
> don't see any difference.

 The difference is that with using a method of ReflectionFunction or
 ReflectionMethod I do not have to switch paradigms (Reflection API and
 OOP vs. call_user_func*() and non-OOP).

-- 
Sebastian Bergmann                      http://www.sebastian-bergmann.de/
GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69

---

## #13693 — Marcus Boerger — 2004-11-02T23:58:34+00:00

URL: https://externals.io/message/13679#13693 · In reply to: #13691

Hello Sebastian, hello Timm,

  after all the differnece is whether we know of the typical PHP user can
find out.

marcus

p.s.: Timm you're going to FFM?

Tuesday, November 2, 2004, 11:45:18 PM, you wrote:

> Timm Friebe wrote:
> > […]

>  The difference is that with using a method of ReflectionFunction or
>  ReflectionMethod I do not have to switch paradigms (Reflection API and
>  OOP vs. call_user_func*() and non-OOP).

> -- 
> Sebastian Bergmann                      http://www.sebastian-bergmann.de/
> GnuPG Key: 0xB85B5D69 / 27A7 2B14 09E4 98CD 6277 0E5B 6867 C514 B85B 5D69




-- 
Best regards,
 Marcus                            mailto:helly@php.net
