# [PATCH] extend zend_parse_parameters() functionality (2nd attempt)

- Thread: https://externals.io/message/2903
- Original archive: https://news-web.php.net/php.internals/2903
- Started by fuhs@purdue.edu on 2003-06-27T18:18:32+00:00
- Messages: 3
- 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

---

## #2903 — fuhs@purdue.edu — 2003-06-27T18:18:32+00:00

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

Hello,

I propose that a new type, 'Z', be added in order to allow the extension coders
access to the zval** which was available with the now deprecated
zend_get_parameters().

I came to this conclusion after tracing some segfaults to a section of code
similar to this:

    zval *zend_value;
    if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zend_value) ==
       FAILURE)
        return;

    convert_to_array_ex(&zend_value);

I realized after sifting through the Zend code that the proper handling of zval*
types is just as important as that of the zval's. This modification will
give extension programmers access to legitimate zval*'s and their corresponding
zval.

Zend/zend_API.c RELEASE ver 4.3.1
425c425,434
<
---
>               case 'Z':
>                       {
>                               zval ***p=va_arg(*va, zval ***);
>                               if(Z_TYPE_PP(arg) == IS_NULL && return_null){
>                                      *p = NULL;
>                               } else {
>                                      *p = arg;
>                               }
>                       }
>                       break;
474c483
<                       case 'z':
---
>                       case 'z': case 'Z':


Josh

---

## #2904 — Andrei Zmievski — 2003-06-27T18:33:01+00:00

URL: https://externals.io/message/2903#2904 · In reply to: #2903

> I propose that a new type, 'Z', be added in order to allow the extension coders
> access to the zval** which was available with the now deprecated
> zend_get_parameters().
> 
> I came to this conclusion after tracing some segfaults to a section of code
> similar to this:
> 
>     zval *zend_value;
>     if(zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &zend_value) ==
>        FAILURE)
>         return;
> 
>     convert_to_array_ex(&zend_value);
> 
> I realized after sifting through the Zend code that the proper handling of zval*
> types is just as important as that of the zval's. This modification will
> give extension programmers access to legitimate zval*'s and their corresponding
> zval.

If you want zval**'s, use zend_get_parameters().

-Andrei

"The most exciting phrase to hear in science, the one that heralds new
discoveries, is not "Eureka!" but "That's funny..." -- Isaac Asimov.

---

## #2907 — fuhs@purdue.edu — 2003-06-27T18:46:41+00:00

URL: https://externals.io/message/2903#2907 · In reply to: #2904

Quoting Andrei Zmievski <andrei@gravitonic.com>:

> 
> If you want zval**'s, use zend_get_parameters().
> 
> -Andrei
> 

How does one get zval**'s in a non-deprecated way?

Josh
