# Method for validating call-back functions

- Thread: https://externals.io/message/12417
- Original archive: https://news-web.php.net/php.internals/12417
- Started by Aidan Lister on 2004-08-27T10:10:13+00:00
- Messages: 1
- 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

---

## #12417 — Aidan Lister — 2004-08-27T10:10:13+00:00

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

Hey,

I was messing around with array_walk[_recursive] and found the behaviour it
uses to validate callback functions completely different to other standard
functions.

array_walk_recursive
http://lxr.php.net/source/php-src/ext/standard/array.c#1111

array_filter
http://lxr.php.net/source/php-src/ext/standard/array.c#3973

array_map
http://lxr.php.net/source/php-src/ext/standard/array.c#4065


Now, apart from the internal differences, the external differences are quite
apparent.

array_walk[_recursive] called with an array('foo','bar') as a callback will
throw a E_FATAL
* reproduce: php -r '$var=array('foo','bar'); array_walk_recursive($var,
array('foo','bar'));'

Compared to only an `E_WARNING` for other functions.
* reproduce: php -r '$var=array('foo','bar'); array_filter($var,
array('foo','bar'));'

Is there a good reason for this? Perhaps we could implement a standard
method for such validation?


On a side note, with php_error_docref errors, please don't add a full stop
to the end of the error message!


Kind Regards,
Aidan Lister
