Skip to content

Commit 9b391a8

Browse files
author
Derick Rethans
committed
- MFZE1 for exit fix, exposing current function name in error messages and
exposing zend_zval_type_name().
1 parent 7f428de commit 9b391a8

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

Zend/zend_API.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D)
166166

167167
/* Argument parsing API -- andrei */
168168

169-
static char *zend_zval_type_name(zval *arg)
169+
ZEND_API char *zend_zval_type_name(zval *arg)
170170
{
171171
switch (Z_TYPE_P(arg)) {
172172
case IS_NULL:

Zend/zend_API.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_arr
128128
#define ZEND_PARSE_PARAMS_QUIET 1<<1
129129
ZEND_API int zend_parse_parameters(int num_args TSRMLS_DC, char *type_spec, ...);
130130
ZEND_API int zend_parse_parameters_ex(int flags, int num_args TSRMLS_DC, char *type_spec, ...);
131+
ZEND_API char *zend_zval_type_name(zval *arg);
131132

132133
/* End of parameter parsing API -- andrei */
133134

Zend/zend_execute.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2634,8 +2634,9 @@ binary_assign_op_addr: {
26342634
ptr = get_zval_ptr(&EX(opline)->op1, EX(Ts), &EG(free_op1), BP_VAR_R);
26352635
if (Z_TYPE_P(ptr) == IS_LONG) {
26362636
EG(exit_status) = Z_LVAL_P(ptr);
2637+
} else {
2638+
zend_print_variable(ptr);
26372639
}
2638-
zend_print_variable(ptr);
26392640
FREE_OP(EX(Ts), &EX(opline)->op1, EG(free_op1));
26402641
}
26412642
zend_bailout();

Zend/zend_list.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,12 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
117117
if (default_id==-1) { /* use id */
118118
if (!passed_id) {
119119
if (resource_type_name) {
120-
zend_error(E_WARNING, "No %s resource supplied", resource_type_name);
120+
zend_error(E_WARNING, "%s(): no %s resource supplied", get_active_function_name(TSRMLS_C), resource_type_name);
121121
}
122122
return NULL;
123123
} else if ((*passed_id)->type != IS_RESOURCE) {
124124
if (resource_type_name) {
125-
zend_error(E_WARNING, "Supplied argument is not a valid %s resource", resource_type_name);
125+
zend_error(E_WARNING, "%s(): supplied argument is not a valid %s resource", get_active_function_name(TSRMLS_C), resource_type_name);
126126
}
127127
return NULL;
128128
}
@@ -134,7 +134,7 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
134134
resource = zend_list_find(id, &actual_resource_type);
135135
if (!resource) {
136136
if (resource_type_name) {
137-
zend_error(E_WARNING, "%d is not a valid %s resource", id, resource_type_name);
137+
zend_error(E_WARNING, "%s(): %d is not a valid %s resource", get_active_function_name(TSRMLS_C), id, resource_type_name);
138138
}
139139
return NULL;
140140
}
@@ -152,7 +152,7 @@ ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, c
152152
va_end(resource_types);
153153

154154
if (resource_type_name) {
155-
zend_error(E_WARNING, "Supplied resource is not a valid %s resource", resource_type_name);
155+
zend_error(E_WARNING, "%s(): supplied resource is not a valid %s resource", get_active_function_name(TSRMLS_C), resource_type_name);
156156
}
157157

158158
return NULL;

0 commit comments

Comments
 (0)