Skip to content

Commit 39612af

Browse files
committed
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Reduce (some) compile noise of 'unused variable' and 'may be used uninitialized' warnings. Conflicts: ext/dba/libinifile/inifile.c
2 parents 8c61758 + 9ad97cd commit 39612af

File tree

21 files changed

+30
-31
lines changed

21 files changed

+30
-31
lines changed

ext/date/php_date.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ char *php_date_short_day_name(timelib_sll y, timelib_sll m, timelib_sll d)
10411041
static char *date_format(char *format, int format_len, timelib_time *t, int localtime)
10421042
{
10431043
smart_str string = {0};
1044-
int i, length;
1044+
int i, length = 0;
10451045
char buffer[97];
10461046
timelib_time_offset *offset = NULL;
10471047
timelib_sll isoweek, isoyear;
@@ -2538,8 +2538,8 @@ PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str,
25382538
timelib_time *now;
25392539
timelib_tzinfo *tzi = NULL;
25402540
timelib_error_container *err = NULL;
2541-
int type = TIMELIB_ZONETYPE_ID, new_dst;
2542-
char *new_abbr;
2541+
int type = TIMELIB_ZONETYPE_ID, new_dst = 0;
2542+
char *new_abbr = NULL;
25432543
timelib_sll new_offset;
25442544

25452545
if (dateobj->time) {

ext/dom/xpath.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ const zend_function_entry php_dom_xpath_class_functions[] = {
7474

7575
static void dom_xpath_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int type) /* {{{ */
7676
{
77-
zval **args;
77+
zval **args = NULL;
7878
zval *retval;
7979
int result, i, ret;
8080
int error = 0;

ext/gmp/gmp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ ZEND_FUNCTION(gmp_powm)
10691069
zval **base_arg, **exp_arg, **mod_arg;
10701070
mpz_t *gmpnum_base, *gmpnum_exp, *gmpnum_mod, *gmpnum_result;
10711071
int use_ui = 0;
1072-
int temp_base, temp_exp, temp_mod;
1072+
int temp_base = 0, temp_exp = 0, temp_mod;
10731073

10741074
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ZZZ", &base_arg, &exp_arg, &mod_arg) == FAILURE){
10751075
return;

ext/intl/grapheme/grapheme_util.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ void grapheme_substr_ascii(char *str, int str_len, int f, int l, int argc, char
130130
/* {{{ grapheme_strpos_utf16 - strrpos using utf16*/
131131
int grapheme_strpos_utf16(unsigned char *haystack, int32_t haystack_len, unsigned char*needle, int32_t needle_len, int32_t offset, int32_t *puchar_pos, int f_ignore_case, int last TSRMLS_DC)
132132
{
133-
UChar *uhaystack = NULL, *puhaystack, *uneedle = NULL;
133+
UChar *uhaystack = NULL, *uneedle = NULL;
134134
int32_t uhaystack_len = 0, uneedle_len = 0, char_pos, ret_pos, offset_pos = 0;
135135
unsigned char u_break_iterator_buffer[U_BRK_SAFECLONE_BUFFERSIZE];
136136
UBreakIterator* bi = NULL;

ext/intl/resourcebundle/resourcebundle_class.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ PHP_FUNCTION( resourcebundle_create )
161161
/* {{{ resourcebundle_array_fetch */
162162
static void resourcebundle_array_fetch(zval *object, zval *offset, zval *return_value, int fallback TSRMLS_DC)
163163
{
164-
int32_t meindex;
165-
char * mekey;
164+
int32_t meindex = 0;
165+
char * mekey = NULL;
166166
long mekeylen;
167167
zend_bool is_numeric = 0;
168168
char *pbuf;

ext/openssl/openssl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ static void add_assoc_name_entry(zval * val, char * key, X509_NAME * name, int s
591591

592592
for (i = 0; i < X509_NAME_entry_count(name); i++) {
593593
unsigned char *to_add;
594-
int to_add_len;
594+
int to_add_len = 0;
595595

596596

597597
ne = X509_NAME_get_entry(name, i);

ext/openssl/xp_ssl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ static inline int php_openssl_enable_crypto(php_stream *stream,
472472

473473
do {
474474
struct timeval cur_time,
475-
elapsed_time;
475+
elapsed_time = {0};
476476

477477
if (sslsock->is_client) {
478478
n = SSL_connect(sslsock->ssl_handle);

ext/session/session.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ PHPAPI char *php_session_create_id(PS_CREATE_SID_ARGS) /* {{{ */
286286
PHP_MD5_CTX md5_context;
287287
PHP_SHA1_CTX sha1_context;
288288
#if defined(HAVE_HASH_EXT) && !defined(COMPILE_DL_HASH)
289-
void *hash_context;
289+
void *hash_context = NULL;
290290
#endif
291291
unsigned char *digest;
292292
int digest_len;

ext/simplexml/simplexml.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ static HashTable * sxe_get_prop_hash(zval *object, int is_debug TSRMLS_DC) /* {{
10701070
int namelen;
10711071
int test;
10721072
char use_iter;
1073-
zval *iter_data;
1073+
zval *iter_data = NULL;
10741074

10751075
use_iter = 0;
10761076

ext/snmp/snmp.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ static zend_object_value php_snmp_object_new(zend_class_entry *class_type TSRMLS
514514
static void php_snmp_error(zval *object, const char *docref TSRMLS_DC, int type, const char *format, ...)
515515
{
516516
va_list args;
517-
php_snmp_object *snmp_object;
517+
php_snmp_object *snmp_object = NULL;
518518

519519
if (object) {
520520
snmp_object = (php_snmp_object *)zend_object_store_get_object(object TSRMLS_CC);

ext/spl/spl_array.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ zend_object_iterator *spl_array_get_iterator(zend_class_entry *ce, zval *object,
166166
/* {{{ spl_array_object_new_ex */
167167
static zend_object_value spl_array_object_new_ex(zend_class_entry *class_type, spl_array_object **obj, zval *orig, int clone_orig TSRMLS_DC)
168168
{
169-
zend_object_value retval;
169+
zend_object_value retval = {0};
170170
spl_array_object *intern;
171171
zval *tmp;
172172
zend_class_entry * parent = class_type;

ext/spl/spl_dllist.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ zend_object_iterator *spl_dllist_get_iterator(zend_class_entry *ce, zval *object
368368

369369
static zend_object_value spl_dllist_object_new_ex(zend_class_entry *class_type, spl_dllist_object **obj, zval *orig, int clone_orig TSRMLS_DC) /* {{{ */
370370
{
371-
zend_object_value retval;
371+
zend_object_value retval = {0};
372372
spl_dllist_object *intern;
373373
zend_class_entry *parent = class_type;
374374
int inherited = 0;

ext/standard/array.c

+4-5
Original file line numberDiff line numberDiff line change
@@ -3030,8 +3030,8 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
30303030
char *param_spec;
30313031
zend_fcall_info fci1, fci2;
30323032
zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache;
3033-
zend_fcall_info *fci_key, *fci_data;
3034-
zend_fcall_info_cache *fci_key_cache, *fci_data_cache;
3033+
zend_fcall_info *fci_key = NULL, *fci_data;
3034+
zend_fcall_info_cache *fci_key_cache = NULL, *fci_data_cache;
30353035
PHP_ARRAY_CMP_FUNC_VARS;
30363036

30373037
int (*intersect_key_compare_func)(const void *, const void * TSRMLS_DC);
@@ -3448,8 +3448,8 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
34483448
char *param_spec;
34493449
zend_fcall_info fci1, fci2;
34503450
zend_fcall_info_cache fci1_cache = empty_fcall_info_cache, fci2_cache = empty_fcall_info_cache;
3451-
zend_fcall_info *fci_key, *fci_data;
3452-
zend_fcall_info_cache *fci_key_cache, *fci_data_cache;
3451+
zend_fcall_info *fci_key = NULL, *fci_data;
3452+
zend_fcall_info_cache *fci_key_cache = NULL, *fci_data_cache;
34533453
PHP_ARRAY_CMP_FUNC_VARS;
34543454

34553455
int (*diff_key_compare_func)(const void *, const void * TSRMLS_DC);
@@ -4053,7 +4053,6 @@ PHP_FUNCTION(array_sum)
40534053
**entry,
40544054
entry_n;
40554055
HashPosition pos;
4056-
double dval;
40574056

40584057
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &input) == FAILURE) {
40594058
return;

ext/standard/html.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -1221,8 +1221,8 @@ PHPAPI char *php_escape_html_entities_ex(unsigned char *old, size_t oldlen, size
12211221
const enc_to_uni *to_uni_table = NULL;
12221222
const entity_ht *inv_map = NULL; /* used for !double_encode */
12231223
/* only used if flags includes ENT_HTML_IGNORE_ERRORS or ENT_HTML_SUBSTITUTE_DISALLOWED_CHARS */
1224-
const unsigned char *replacement;
1225-
size_t replacement_len;
1224+
const unsigned char *replacement = NULL;
1225+
size_t replacement_len = 0;
12261226

12271227
if (all) { /* replace with all named entities */
12281228
if (CHARSET_PARTIAL_SUPPORT(charset)) {
@@ -1596,7 +1596,7 @@ PHP_FUNCTION(get_html_translation_table)
15961596
flags = ENT_COMPAT;
15971597
int doctype;
15981598
entity_table_opt entity_table;
1599-
const enc_to_uni *to_uni_table;
1599+
const enc_to_uni *to_uni_table = NULL;
16001600
char *charset_hint = NULL;
16011601
int charset_hint_len;
16021602
enum entity_charset charset;

ext/standard/string.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3204,7 +3204,7 @@ static void php_similar_str(const char *txt1, int len1, const char *txt2, int le
32043204
static int php_similar_char(const char *txt1, int len1, const char *txt2, int len2)
32053205
{
32063206
int sum;
3207-
int pos1, pos2, max;
3207+
int pos1 = 0, pos2 = 0, max;
32083208

32093209
php_similar_str(txt1, len1, txt2, len2, &pos1, &pos2, &max);
32103210
if ((sum = max)) {
@@ -4564,7 +4564,7 @@ PHPAPI size_t php_strip_tags_ex(char *rbuf, int len, int *stateptr, char *allow,
45644564
char *tbuf, *buf, *p, *tp, *rp, c, lc;
45654565
int br, i=0, depth=0, in_q = 0;
45664566
int state = 0, pos;
4567-
char *allow_free;
4567+
char *allow_free = NULL;
45684568

45694569
if (stateptr)
45704570
state = *stateptr;

ext/standard/url_scanner_ex.re

+1-1
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ static void php_url_scanner_output_handler(char *output, uint output_len, char *
463463

464464
PHPAPI int php_url_scanner_add_var(char *name, int name_len, char *value, int value_len, int urlencode TSRMLS_DC)
465465
{
466-
char *encoded;
466+
char *encoded = NULL;
467467
int encoded_len;
468468
smart_str val;
469469

ext/xsl/xsltprocessor.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ PHP_FUNCTION(xsl_xsltprocessor_import_stylesheet)
476476

477477
static xmlDocPtr php_xsl_apply_stylesheet(zval *id, xsl_object *intern, xsltStylesheetPtr style, zval *docp TSRMLS_DC) /* {{{ */
478478
{
479-
xmlDocPtr newdocp;
479+
xmlDocPtr newdocp = NULL;
480480
xmlDocPtr doc = NULL;
481481
xmlNodePtr node = NULL;
482482
xsltTransformContextPtr ctxt;

ext/zip/php_zip.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
16541654
char *path = NULL;
16551655
char *remove_path = NULL;
16561656
char *add_path = NULL;
1657-
int pattern_len, add_path_len, remove_path_len, path_len = 0;
1657+
int pattern_len, add_path_len = 0, remove_path_len = 0, path_len = 0;
16581658
long remove_all_path = 0;
16591659
long flags = 0;
16601660
zval *options = NULL;

main/php_variables.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ PHPAPI void php_register_variable_safe(char *var, char *strval, int str_len, zva
5555
PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars_array TSRMLS_DC)
5656
{
5757
char *p = NULL;
58-
char *ip; /* index pointer */
58+
char *ip = NULL; /* index pointer */
5959
char *index;
6060
char *var, *var_orig;
6161
int var_len, index_len;

main/rfc1867.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ static int find_boundary(multipart_buffer *self, char *boundary TSRMLS_DC)
398398
static int multipart_buffer_headers(multipart_buffer *self, zend_llist *header TSRMLS_DC)
399399
{
400400
char *line;
401-
mime_header_entry prev_entry, entry;
401+
mime_header_entry prev_entry = {0}, entry;
402402
int prev_len, cur_len;
403403

404404
/* didn't find boundary, abort */

sapi/cli/php_cli_server.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ static void php_cli_server_request_translate_vpath(php_cli_server_request *reque
13351335
static const char *index_files[] = { "index.php", "index.html", NULL };
13361336
char *buf = safe_pemalloc(1, request->vpath_len, 1 + document_root_len + 1 + sizeof("index.html"), 1);
13371337
char *p = buf, *prev_path = NULL, *q, *vpath;
1338-
size_t prev_path_len;
1338+
size_t prev_path_len = 0;
13391339
int is_static_file = 0;
13401340

13411341
if (!buf) {

0 commit comments

Comments
 (0)