# PHP5 and zend_parse_parameters

- Thread: https://externals.io/message/882
- Original archive: https://news-web.php.net/php.internals/882
- Started by l0t3k on 2003-04-13T04:08:39+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

---

## #882 — l0t3k — 2003-04-13T04:08:39+00:00

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

i have an OOP based extension for PHP5 which also uses exceptions
extensively. it would seem more in character with OOP to throw an
IllegalArgument exception or some-such when a parameter type does not  meet
our expectations. otherwise we end up with a tenuous mix of error handling
styles.
    zend_parse_parameters_ex has the "quiet" flag, which helps greatly, but
im left without a nice message to include with my exception. is it possible
for some variation of zend_parse_parameters which passes back the error
message ? id rather not pass back a generic message. or am i just being lazy
<g>

l0t3k

---

## #883 — l0t3k — 2003-04-13T04:16:55+00:00

URL: https://externals.io/message/882#883 · In reply to: #882

another alternative is to do two things :
    1) create a standard PHP IllegalArgument exception
    2) create another flag for zend_parse_parameters_ex (
ZEND_PARSE_PARAMS_ERRORS_AS_EXCEPTIONS)
when this flag is set, an IllegalArgument exception is raised with the
appropriate message. A FAILURE return value in this instance would let the
caller know that the exception was raised.
  i actually think this is the cleaner way to go.

l0t3k
"L0t3k" <cshmoove@bellsouth.net> wrote in message
news:20030413040828.37736.qmail@pb1.pair.com...
>     zend_parse_parameters_ex has the "quiet" flag, which helps greatly,
but
> im left without a nice message to include with my exception. is it
possible
> for some variation of zend_parse_parameters which passes back the error
> message ? id rather not pass back a generic message. or am i just being
lazy
> <g>
>
> l0t3k
