diff --git a/Zend/zend_types.h b/Zend/zend_types.h index 7ec8fe3b965..7f2fdae4395 100644 --- a/Zend/zend_types.h +++ b/Zend/zend_types.h @@ -1346,27 +1346,22 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) { } while (0) #define SEPARATE_ARRAY(zv) do { \ - zval *_zv = (zv); \ - zend_array *_arr = Z_ARR_P(_zv); \ + zval *__zv = (zv); \ + zend_array *_arr = Z_ARR_P(__zv); \ if (UNEXPECTED(GC_REFCOUNT(_arr) > 1)) { \ - if (Z_REFCOUNTED_P(_zv)) { \ + if (Z_REFCOUNTED_P(__zv)) { \ GC_DELREF(_arr); \ } \ - ZVAL_ARR(_zv, zend_array_dup(_arr)); \ - } \ - } while (0) - -#define SEPARATE_ZVAL_IF_NOT_REF(zv) do { \ - zval *__zv = (zv); \ - if (Z_TYPE_P(__zv) == IS_ARRAY) { \ - SEPARATE_ARRAY(__zv); \ + ZVAL_ARR(__zv, zend_array_dup(_arr)); \ } \ } while (0) #define SEPARATE_ZVAL_NOREF(zv) do { \ zval *_zv = (zv); \ ZEND_ASSERT(Z_TYPE_P(_zv) != IS_REFERENCE); \ - SEPARATE_ZVAL_IF_NOT_REF(_zv); \ + if (Z_TYPE_P(_zv) == IS_ARRAY) { \ + SEPARATE_ARRAY(_zv); \ + } \ } while (0) #define SEPARATE_ZVAL(zv) do { \ @@ -1384,7 +1379,9 @@ static zend_always_inline uint32_t zval_delref_p(zval* pz) { break; \ } \ } \ - SEPARATE_ZVAL_IF_NOT_REF(_zv); \ + if (Z_TYPE_P(_zv) == IS_ARRAY) { \ + SEPARATE_ARRAY(_zv); \ + } \ } while (0) /* Properties store a flag distinguishing unset and uninitialized properties diff --git a/docs/parameter-parsing-api.md b/docs/parameter-parsing-api.md index 2883c7014c0..c962fc6ee58 100644 --- a/docs/parameter-parsing-api.md +++ b/docs/parameter-parsing-api.md @@ -93,7 +93,7 @@ The following characters also have a meaning in the specifier string: * `|` - indicates that the remaining parameters are optional, they should be initialized to default values by the extension since they will not be touched by the parsing function if they are not passed to it. -* `/` - use SEPARATE_ZVAL_IF_NOT_REF() on the parameter it follows +* `/` - use SEPARATE_ZVAL() on the parameter it follows * `!` - the parameter it follows can be of specified type or NULL. If NULL is passed and the output for such type is a pointer, then the output pointer is set to a native NULL pointer. For 'b', 'l' and 'd', an extra argument of type diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index c136d69c52b..3a8b49041df 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -359,7 +359,6 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * } else { zend_string *str = php_stream_copy_to_mem(stm, PHP_STREAM_COPY_ALL, 0); if (str != NULL) { - //??SEPARATE_ZVAL_IF_NOT_REF(¶m->parameter); ZVAL_STR(parameter, str); } else { ZVAL_EMPTY_STRING(parameter); @@ -381,7 +380,6 @@ static int pgsql_stmt_param_hook(pdo_stmt_t *stmt, struct pdo_bound_param_data * S->param_lengths[param->paramno] = 1; S->param_formats[param->paramno] = 0; } else { - //SEPARATE_ZVAL_IF_NOT_REF(¶m->parameter); convert_to_string_ex(parameter); S->param_values[param->paramno] = Z_STRVAL_P(parameter); S->param_lengths[param->paramno] = Z_STRLEN_P(parameter);