Skip to content

Commit 7f6c22c

Browse files
committed
Fix last maybe uninit warnings on 7.4
Most of these only occur under GCC 5. Not fond of all the workarounds (especially the PDO one), but it gets us a clean build...
1 parent 908660c commit 7f6c22c

File tree

7 files changed

+14
-8
lines changed

7 files changed

+14
-8
lines changed

Zend/zend_vm_def.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7932,7 +7932,7 @@ ZEND_VM_HANDLER(157, ZEND_FETCH_CLASS_NAME, UNUSED|CLASS_FETCH, ANY)
79327932

79337933
ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
79347934
{
7935-
zend_array *args;
7935+
zend_array *args = NULL;
79367936
zend_function *fbc = EX(func);
79377937
zval *ret = EX(return_value);
79387938
uint32_t call_info = EX_CALL_INFO() & (ZEND_CALL_NESTED | ZEND_CALL_TOP | ZEND_CALL_RELEASE_THIS);
@@ -7963,7 +7963,7 @@ ZEND_VM_HANDLER(158, ZEND_CALL_TRAMPOLINE, ANY, ANY)
79637963
ZEND_CALL_NUM_ARGS(call) = 2;
79647964

79657965
ZVAL_STR(ZEND_CALL_ARG(call, 1), fbc->common.function_name);
7966-
if (num_args) {
7966+
if (args) {
79677967
ZVAL_ARR(ZEND_CALL_ARG(call, 2), args);
79687968
} else {
79697969
ZVAL_EMPTY_ARRAY(ZEND_CALL_ARG(call, 2));

Zend/zend_vm_execute.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2134,7 +2134,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSERT_CHECK_SPEC_HANDLER(ZEND
21342134

21352135
static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
21362136
{
2137-
zend_array *args;
2137+
zend_array *args = NULL;
21382138
zend_function *fbc = EX(func);
21392139
zval *ret = EX(return_value);
21402140
uint32_t call_info = EX_CALL_INFO() & (ZEND_CALL_NESTED | ZEND_CALL_TOP | ZEND_CALL_RELEASE_THIS);
@@ -2165,7 +2165,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_CALL_TRAMPOLINE_SPEC_HANDLER(Z
21652165
ZEND_CALL_NUM_ARGS(call) = 2;
21662166

21672167
ZVAL_STR(ZEND_CALL_ARG(call, 1), fbc->common.function_name);
2168-
if (num_args) {
2168+
if (args) {
21692169
ZVAL_ARR(ZEND_CALL_ARG(call, 2), args);
21702170
} else {
21712171
ZVAL_EMPTY_ARRAY(ZEND_CALL_ARG(call, 2));

ext/pdo/pdo_stmt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_
819819
{
820820
int flags, idx, old_arg_count = 0;
821821
zend_class_entry *ce = NULL, *old_ce = NULL;
822-
zval grp_val, *pgrp, retval, old_ctor_args;
822+
zval grp_val, *pgrp, retval, old_ctor_args = {0};
823823
int colno;
824824

825825
if (how == PDO_FETCH_USE_DEFAULT) {

ext/simplexml/simplexml.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,6 +1016,7 @@ static int sxe_prop_is_empty(zval *object) /* {{{ */
10161016
zval iter_data;
10171017
int test;
10181018
int is_empty;
1019+
int use_iter = 0;
10191020

10201021
sxe = Z_SXEOBJ_P(object);
10211022

@@ -1052,6 +1053,7 @@ static int sxe_prop_is_empty(zval *object) /* {{{ */
10521053
ZVAL_COPY_VALUE(&iter_data, &sxe->iter.data);
10531054
ZVAL_UNDEF(&sxe->iter.data);
10541055
node = php_sxe_reset_iterator(sxe, 0);
1056+
use_iter = 1;
10551057
}
10561058
}
10571059

@@ -1080,15 +1082,15 @@ static int sxe_prop_is_empty(zval *object) /* {{{ */
10801082
is_empty = 0;
10811083
break;
10821084
next_iter:
1083-
if (!Z_ISUNDEF(iter_data)) {
1085+
if (use_iter) {
10841086
node = php_sxe_iterator_fetch(sxe, node->next, 0);
10851087
} else {
10861088
node = node->next;
10871089
}
10881090
}
10891091
}
10901092

1091-
if (!Z_ISUNDEF(iter_data)) {
1093+
if (use_iter) {
10921094
if (!Z_ISUNDEF(sxe->iter.data)) {
10931095
zval_ptr_dtor(&sxe->iter.data);
10941096
}

ext/sockets/conversions.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,9 @@ static void from_zval_write_sockaddr_aux(const zval *container,
701701
zval *elem;
702702
int fill_sockaddr;
703703

704+
*sockaddr_ptr = NULL;
705+
*sockaddr_len = 0;
706+
704707
if (Z_TYPE_P(container) != IS_ARRAY) {
705708
do_from_zval_err(ctx, "%s", "expected an array here");
706709
return;

ext/standard/php_fopen_wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa
181181
int fd = -1;
182182
int mode_rw = 0;
183183
php_stream * stream = NULL;
184-
char *p, *token, *pathdup;
184+
char *p, *token = NULL, *pathdup;
185185
zend_long max_memory;
186186
FILE *file = NULL;
187187
#ifdef PHP_WIN32

sapi/cli/php_cli_server.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1448,6 +1448,7 @@ static void normalize_vpath(char **retval, size_t *retval_len, const char *vpath
14481448
char *p;
14491449

14501450
*retval = NULL;
1451+
*retval_len = 0;
14511452

14521453
decoded_vpath = pestrndup(vpath, vpath_len, persistent);
14531454
if (!decoded_vpath) {

0 commit comments

Comments
 (0)