Skip to content

Commit 3f51d82

Browse files
committed
Rename zend_zval_get_type() API
We have a bunch of APIs for getting type names and it's sometimes hard to keep them apart ... make it clear that this is the one you definitely do not want to use.
1 parent 256b7da commit 3f51d82

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

Zend/zend_API.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ ZEND_API const char *zend_zval_type_name(const zval *arg) /* {{{ */
138138
}
139139
/* }}} */
140140

141-
ZEND_API zend_string *zend_zval_get_type(const zval *arg) /* {{{ */
141+
/* This API exists *only* for use in gettype().
142+
* For anything else, you likely want zend_zval_type_name(). */
143+
ZEND_API zend_string *zend_zval_get_legacy_type(const zval *arg) /* {{{ */
142144
{
143145
switch (Z_TYPE_P(arg)) {
144146
case IS_NULL:

Zend/zend_API.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ ZEND_API int zend_parse_parameters_ex(int flags, int num_args, const char *type_
301301
#define zend_parse_parameters_throw(num_args, ...) \
302302
zend_parse_parameters(num_args, __VA_ARGS__)
303303
ZEND_API const char *zend_zval_type_name(const zval *arg);
304-
ZEND_API zend_string *zend_zval_get_type(const zval *arg);
304+
ZEND_API zend_string *zend_zval_get_legacy_type(const zval *arg);
305305

306306
ZEND_API int zend_parse_method_parameters(int num_args, zval *this_ptr, const char *type_spec, ...);
307307
ZEND_API int zend_parse_method_parameters_ex(int flags, int num_args, zval *this_ptr, const char *type_spec, ...);

Zend/zend_vm_def.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8562,7 +8562,7 @@ ZEND_VM_COLD_CONST_HANDLER(193, ZEND_GET_TYPE, CONST|TMP|VAR|CV, UNUSED)
85628562

85638563
SAVE_OPLINE();
85648564
op1 = GET_OP1_ZVAL_PTR_DEREF(BP_VAR_R);
8565-
type = zend_zval_get_type(op1);
8565+
type = zend_zval_get_legacy_type(op1);
85668566
if (EXPECTED(type)) {
85678567
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), type);
85688568
} else {

Zend/zend_vm_execute.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9360,7 +9360,7 @@ static ZEND_VM_COLD ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_CON
93609360

93619361
SAVE_OPLINE();
93629362
op1 = RT_CONSTANT(opline, opline->op1);
9363-
type = zend_zval_get_type(op1);
9363+
type = zend_zval_get_legacy_type(op1);
93649364
if (EXPECTED(type)) {
93659365
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), type);
93669366
} else {
@@ -19087,7 +19087,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_TMP_UNUSED_HANDL
1908719087

1908819088
SAVE_OPLINE();
1908919089
op1 = _get_zval_ptr_tmp(opline->op1.var EXECUTE_DATA_CC);
19090-
type = zend_zval_get_type(op1);
19090+
type = zend_zval_get_legacy_type(op1);
1909119091
if (EXPECTED(type)) {
1909219092
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), type);
1909319093
} else {
@@ -26693,7 +26693,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_VAR_UNUSED_HANDL
2669326693

2669426694
SAVE_OPLINE();
2669526695
op1 = _get_zval_ptr_var_deref(opline->op1.var EXECUTE_DATA_CC);
26696-
type = zend_zval_get_type(op1);
26696+
type = zend_zval_get_legacy_type(op1);
2669726697
if (EXPECTED(type)) {
2669826698
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), type);
2669926699
} else {
@@ -45286,7 +45286,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_GET_TYPE_SPEC_CV_UNUSED_HANDLE
4528645286

4528745287
SAVE_OPLINE();
4528845288
op1 = _get_zval_ptr_cv_deref_BP_VAR_R(opline->op1.var EXECUTE_DATA_CC);
45289-
type = zend_zval_get_type(op1);
45289+
type = zend_zval_get_legacy_type(op1);
4529045290
if (EXPECTED(type)) {
4529145291
ZVAL_INTERNED_STR(EX_VAR(opline->result.var), type);
4529245292
} else {

ext/standard/type.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ PHP_FUNCTION(gettype)
2828
Z_PARAM_ZVAL(arg)
2929
ZEND_PARSE_PARAMETERS_END();
3030

31-
type = zend_zval_get_type(arg);
31+
type = zend_zval_get_legacy_type(arg);
3232
if (EXPECTED(type)) {
3333
RETURN_INTERNED_STR(type);
3434
} else {

0 commit comments

Comments
 (0)