summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/iconv/iconv.c31
-rw-r--r--ext/mysql/php_mysql.c6
-rw-r--r--ext/standard/array.c10
-rw-r--r--ext/standard/assert.c2
-rw-r--r--ext/standard/basic_functions.c6
-rw-r--r--ext/standard/browscap.c2
-rw-r--r--ext/standard/crypt.c2
-rw-r--r--ext/standard/file.c6
-rw-r--r--ext/standard/filestat.c2
-rw-r--r--ext/standard/head.c2
-rw-r--r--ext/standard/html.c2
-rw-r--r--ext/standard/http.c2
-rw-r--r--ext/standard/info.c20
-rw-r--r--ext/standard/mail.c4
-rw-r--r--ext/standard/math.c2
-rw-r--r--ext/standard/proc_open.c2
-rw-r--r--ext/standard/rand.c4
-rw-r--r--ext/standard/streamsfuncs.c4
-rw-r--r--ext/standard/string.c20
-rw-r--r--ext/standard/type.c2
-rw-r--r--ext/standard/versioning.c4
21 files changed, 55 insertions, 80 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index dbe9afbd9a..b1c587fb21 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -1873,7 +1873,7 @@ static void _php_iconv_show_error(php_iconv_err_t err, const char *out_charset,
Returns the character count of str */
PHP_FUNCTION(iconv_strlen)
{
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
char *str;
int str_len;
@@ -1882,8 +1882,6 @@ PHP_FUNCTION(iconv_strlen)
unsigned int retval;
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s",
&str, &str_len, &charset, &charset_len) == FAILURE) {
RETURN_FALSE;
@@ -1908,18 +1906,16 @@ PHP_FUNCTION(iconv_strlen)
Returns specified part of a string */
PHP_FUNCTION(iconv_substr)
{
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
char *str;
int str_len;
- long offset, length;
+ long offset, length = 0;
php_iconv_err_t err;
smart_str retval = {0};
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls",
&str, &str_len, &offset, &length,
&charset, &charset_len) == FAILURE) {
@@ -1950,21 +1946,18 @@ PHP_FUNCTION(iconv_substr)
Finds position of first occurrence of needle within part of haystack beginning with offset */
PHP_FUNCTION(iconv_strpos)
{
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
char *haystk;
int haystk_len;
char *ndl;
int ndl_len;
- long offset;
+ long offset = 0;
php_iconv_err_t err;
unsigned int retval;
- offset = 0;
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ls",
&haystk, &haystk_len, &ndl, &ndl_len,
&offset, &charset, &charset_len) == FAILURE) {
@@ -2001,7 +1994,7 @@ PHP_FUNCTION(iconv_strpos)
Finds position of last occurrence of needle within part of haystack beginning with offset */
PHP_FUNCTION(iconv_strrpos)
{
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
char *haystk;
int haystk_len;
@@ -2012,8 +2005,6 @@ PHP_FUNCTION(iconv_strrpos)
unsigned int retval;
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s",
&haystk, &haystk_len, &ndl, &ndl_len,
&charset, &charset_len) == FAILURE) {
@@ -2167,7 +2158,7 @@ PHP_FUNCTION(iconv_mime_decode)
{
char *encoded_str;
int encoded_str_len;
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
long mode = 0;
@@ -2175,8 +2166,6 @@ PHP_FUNCTION(iconv_mime_decode)
php_iconv_err_t err;
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls",
&encoded_str, &encoded_str_len, &mode, &charset, &charset_len) == FAILURE) {
@@ -2210,14 +2199,12 @@ PHP_FUNCTION(iconv_mime_decode_headers)
{
const char *encoded_str;
int encoded_str_len;
- char *charset;
+ char *charset = ICONVG(internal_encoding);
int charset_len = 0;
long mode = 0;
php_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;
- charset = ICONVG(internal_encoding);
-
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls",
&encoded_str, &encoded_str_len, &mode, &charset, &charset_len) == FAILURE) {
@@ -2422,7 +2409,7 @@ PHP_FUNCTION(iconv_set_encoding)
PHP_FUNCTION(iconv_get_encoding)
{
char *type = "all";
- int type_len;
+ int type_len = sizeof("all")-1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &type, &type_len) == FAILURE)
return;
diff --git a/ext/mysql/php_mysql.c b/ext/mysql/php_mysql.c
index c4c99f03ce..a90dc05373 100644
--- a/ext/mysql/php_mysql.c
+++ b/ext/mysql/php_mysql.c
@@ -1139,7 +1139,7 @@ PHP_FUNCTION(mysql_get_server_info)
Returns a string containing information about the most recent query */
PHP_FUNCTION(mysql_info)
{
- zval *mysql_link;
+ zval *mysql_link = NULL;
int id = -1;
char *str;
php_mysql_conn *mysql;
@@ -2057,8 +2057,8 @@ static void php_mysql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int result_type,
#ifdef ZEND_ENGINE_2
if (into_object) {
- char *class_name;
- int class_name_len;
+ char *class_name = NULL;
+ int class_name_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|sz", &res, &class_name, &class_name_len, &ctor_params) == FAILURE) {
return;
diff --git a/ext/standard/array.c b/ext/standard/array.c
index e4d72a8acf..90f59e65d4 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -1981,14 +1981,14 @@ PHP_FUNCTION(array_unshift)
PHP_FUNCTION(array_splice)
{
zval *array, /* Input array */
- *repl_array, /* Replacement array */
+ *repl_array = NULL, /* Replacement array */
***repl = NULL; /* Replacement elements */
HashTable *new_hash = NULL, /* Output array's hash */
**rem_hash = NULL; /* Removed elements' hash */
Bucket *p; /* Bucket used for traversing hash */
long i,
offset,
- length,
+ length = 0,
repl_num = 0; /* Number of replacement elements */
int num_in; /* Number of elements in the input array */
@@ -2061,7 +2061,7 @@ PHP_FUNCTION(array_splice)
PHP_FUNCTION(array_slice)
{
zval *input, /* Input array */
- **z_length, /* How many elements to get */
+ **z_length = NULL, /* How many elements to get */
**entry; /* An array entry */
long offset, /* Offset to get elements from */
length = 0;
@@ -4004,7 +4004,7 @@ PHP_FUNCTION(array_reduce)
zval *retval;
zend_fcall_info fci;
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
- zval *initial;
+ zval *initial = NULL;
HashPosition pos;
HashTable *htbl;
@@ -4073,7 +4073,7 @@ PHP_FUNCTION(array_filter)
zval *retval = NULL;
zend_bool have_callback = 0;
char *string_key;
- zend_fcall_info fci;
+ zend_fcall_info fci = empty_fcall_info;
zend_fcall_info_cache fci_cache = empty_fcall_info_cache;
uint string_key_len;
ulong num_key;
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 91eacb94a9..37ff546577 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -239,7 +239,7 @@ PHP_FUNCTION(assert)
Set/get the various assert flags */
PHP_FUNCTION(assert_options)
{
- zval **value;
+ zval **value = NULL;
long what;
int oldint;
int ac = ZEND_NUM_ARGS();
diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c
index 51033c6e6e..367572b727 100644
--- a/ext/standard/basic_functions.c
+++ b/ext/standard/basic_functions.c
@@ -5066,9 +5066,9 @@ error options:
PHP_FUNCTION(error_log)
{
char *message, *opt = NULL, *headers = NULL;
- int message_len, opt_len, headers_len;
+ int message_len, opt_len = 0, headers_len = 0;
int opt_err = 0, argc = ZEND_NUM_ARGS();
- long erropt;
+ long erropt = 0;
if (zend_parse_parameters(argc TSRMLS_CC, "s|lss", &message, &message_len, &erropt, &opt, &opt_len, &headers, &headers_len) == FAILURE) {
return;
@@ -5948,7 +5948,7 @@ PHP_FUNCTION(connection_status)
PHP_FUNCTION(ignore_user_abort)
{
char *arg = NULL;
- int arg_len;
+ int arg_len = 0;
int old_setting;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) {
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c
index 8e4e5f3895..8c96f709cd 100644
--- a/ext/standard/browscap.c
+++ b/ext/standard/browscap.c
@@ -326,7 +326,7 @@ static int browser_reg_compare(zval **browser TSRMLS_DC, int num_args, va_list a
PHP_FUNCTION(get_browser)
{
char *agent_name = NULL;
- int agent_name_len;
+ int agent_name_len = 0;
zend_bool return_array = 0;
zval **agent, **z_agent_name;
zval *found_browser_entry, *tmp_copy;
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index 141b63b5b5..cae5226a18 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -136,7 +136,7 @@ PHP_FUNCTION(crypt)
{
char salt[PHP_MAX_SALT_LEN + 1];
char *str, *salt_in = NULL;
- int str_len, salt_in_len;
+ int str_len, salt_in_len = 0;
salt[0] = salt[PHP_MAX_SALT_LEN] = '\0';
diff --git a/ext/standard/file.c b/ext/standard/file.c
index d826d00b9c..cbbda23634 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -1223,7 +1223,7 @@ PHPAPI PHP_FUNCTION(fwrite)
int arg2len;
int ret;
int num_bytes;
- long arg3;
+ long arg3 = 0;
char *buffer = NULL;
php_stream *stream;
@@ -1441,7 +1441,7 @@ PHP_FUNCTION(readfile)
Return or change the umask */
PHP_FUNCTION(umask)
{
- long arg1;
+ long arg1 = 0;
int oldumask;
int arg_count = ZEND_NUM_ARGS();
@@ -1879,7 +1879,7 @@ PHP_FUNCTION(fputcsv)
int ret;
zval *fp = NULL, *fields = NULL, **field_tmp = NULL, field;
char *delimiter_str = NULL, *enclosure_str = NULL;
- int delimiter_str_len, enclosure_str_len;
+ int delimiter_str_len = 0, enclosure_str_len = 0;
HashPosition pos;
int count, i = 0;
smart_str csvline = {0};
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 3ec931c42d..6e1dc3bbc1 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -741,7 +741,7 @@ PHP_FUNCTION(clearstatcache)
{
zend_bool clear_realpath_cache = 0;
char *filename = NULL;
- int filename_len;
+ int filename_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|bs", &clear_realpath_cache, &filename, &filename_len) == FAILURE) {
return;
diff --git a/ext/standard/head.c b/ext/standard/head.c
index 6958fbfccd..3e6c59f133 100644
--- a/ext/standard/head.c
+++ b/ext/standard/head.c
@@ -197,7 +197,7 @@ PHP_FUNCTION(setrawcookie)
Returns true if headers have already been sent, false otherwise */
PHP_FUNCTION(headers_sent)
{
- zval *arg1, *arg2;
+ zval *arg1 = NULL, *arg2 = NULL;
char *file="";
int line=0;
diff --git a/ext/standard/html.c b/ext/standard/html.c
index a32886617b..cb40e82b42 100644
--- a/ext/standard/html.c
+++ b/ext/standard/html.c
@@ -1371,7 +1371,7 @@ done:
PHP_FUNCTION(html_entity_decode)
{
char *str, *hint_charset = NULL;
- int str_len, hint_charset_len, len;
+ int str_len, hint_charset_len = 0, len;
long quote_style = ENT_COMPAT;
char *replaced;
diff --git a/ext/standard/http.c b/ext/standard/http.c
index 09253145ab..dfa4e980df 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -194,7 +194,7 @@ PHP_FUNCTION(http_build_query)
{
zval *formdata;
char *prefix = NULL, *arg_sep=NULL;
- int arg_sep_len, prefix_len = 0;
+ int arg_sep_len = 0, prefix_len = 0;
smart_str formstr = {0};
diff --git a/ext/standard/info.c b/ext/standard/info.c
index c2e435129d..2f21bd79fc 100644
--- a/ext/standard/info.c
+++ b/ext/standard/info.c
@@ -1001,17 +1001,12 @@ void register_phpinfo_constants(INIT_FUNC_ARGS)
Output a page of useful information about PHP and the current request */
PHP_FUNCTION(phpinfo)
{
- int argc = ZEND_NUM_ARGS();
- long flag;
+ long flag = PHP_INFO_ALL;
- if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
return;
}
- if(!argc) {
- flag = PHP_INFO_ALL;
- }
-
/* Andale! Andale! Yee-Hah! */
php_start_ob_buffer(NULL, 4096, 0 TSRMLS_CC);
php_print_info(flag TSRMLS_CC);
@@ -1052,17 +1047,12 @@ PHP_FUNCTION(phpversion)
Prints the list of people who've contributed to the PHP project */
PHP_FUNCTION(phpcredits)
{
- int argc = ZEND_NUM_ARGS();
- long flag;
+ long flag = PHP_CREDITS_ALL;
- if (zend_parse_parameters(argc TSRMLS_CC, "|l", &flag) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &flag) == FAILURE) {
return;
}
- if(!argc) {
- flag = PHP_CREDITS_ALL;
- }
-
php_print_credits(flag TSRMLS_CC);
RETURN_TRUE;
}
@@ -1164,7 +1154,7 @@ PHP_FUNCTION(php_sapi_name)
PHP_FUNCTION(php_uname)
{
char *mode = "a";
- int modelen;
+ int modelen = sizeof("a")-1;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &mode, &modelen) == FAILURE) {
return;
}
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 8fc778440a..a9b6457889 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -95,8 +95,8 @@ PHP_FUNCTION(mail)
{
char *to=NULL, *message=NULL, *headers=NULL;
char *subject=NULL, *extra_cmd=NULL;
- int to_len, message_len, headers_len;
- int subject_len, extra_cmd_len, i;
+ int to_len, message_len, headers_len = 0;
+ int subject_len, extra_cmd_len = 0, i;
char *force_extra_parameters = INI_STR("mail.force_extra_parameters");
char *to_r, *subject_r;
char *p, *e;
diff --git a/ext/standard/math.c b/ext/standard/math.c
index ac9c206437..eec6797862 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1040,7 +1040,7 @@ PHPAPI char *_php_math_number_format(double d, int dec, char dec_point, char tho
PHP_FUNCTION(number_format)
{
double num;
- long dec;
+ long dec = 0;
char *thousand_sep = NULL, *dec_point = NULL;
char thousand_sep_chr = ',', dec_point_chr = '.';
int thousand_sep_len = 0, dec_point_len = 0;
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index b8b2bb3bb3..230cca0f29 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -466,7 +466,7 @@ struct php_proc_open_descriptor_item {
PHP_FUNCTION(proc_open)
{
char *command, *cwd=NULL;
- int command_len, cwd_len;
+ int command_len, cwd_len = 0;
zval *descriptorspec;
zval *pipes;
zval *environment = NULL;
diff --git a/ext/standard/rand.c b/ext/standard/rand.c
index c0cf1b4ac2..f8a9aafda4 100644
--- a/ext/standard/rand.c
+++ b/ext/standard/rand.c
@@ -230,7 +230,7 @@ PHPAPI php_uint32 php_mt_rand(TSRMLS_D)
Seeds random number generator */
PHP_FUNCTION(srand)
{
- long seed;
+ long seed = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE)
return;
@@ -246,7 +246,7 @@ PHP_FUNCTION(srand)
Seeds Mersenne Twister random number generator */
PHP_FUNCTION(mt_srand)
{
- long seed;
+ long seed = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|l", &seed) == FAILURE)
return;
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 348136275b..8aa8391b12 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -1277,7 +1277,7 @@ PHP_FUNCTION(stream_set_blocking)
PHP_FUNCTION(stream_set_timeout)
{
zval *socket;
- long seconds, microseconds;
+ long seconds, microseconds = 0;
struct timeval t;
php_stream *stream;
int argc = ZEND_NUM_ARGS();
@@ -1347,7 +1347,7 @@ PHP_FUNCTION(stream_set_write_buffer)
Enable or disable a specific kind of crypto on the stream */
PHP_FUNCTION(stream_socket_enable_crypto)
{
- long cryptokind;
+ long cryptokind = 0;
zval *zstream, *zsessstream = NULL;
php_stream *stream, *sessstream = NULL;
zend_bool enable;
diff --git a/ext/standard/string.c b/ext/standard/string.c
index dd8f3d5b34..81392f11d9 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -204,10 +204,8 @@ static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior) /
{
char *s11, *s22;
int len1, len2;
- long start, len;
+ long start = 0, len = 0;
- start = 0;
- len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|ll", &s11, &len1,
&s22, &len2, &start, &len) == FAILURE) {
return;
@@ -2060,7 +2058,7 @@ static char *php_chunk_split(char *src, int srclen, char *end, int endlen, int c
Returns split line */
PHP_FUNCTION(chunk_split)
{
- zval **p_chunklen, **p_ending;
+ zval **p_chunklen = NULL, **p_ending = NULL;
char *str;
char *result;
char *end = "\r\n";
@@ -2119,7 +2117,7 @@ PHP_FUNCTION(chunk_split)
PHP_FUNCTION(substr)
{
char *str;
- long l, f;
+ long l = 0, f;
int str_len;
int argc = ZEND_NUM_ARGS();
@@ -2720,8 +2718,8 @@ static void php_strtr_array(zval *return_value, char *str, int slen, HashTable *
PHP_FUNCTION(strtr)
{
zval **from;
- char *str, *to;
- int str_len, to_len;
+ char *str, *to = NULL;
+ int str_len, to_len = 0;
int ac = ZEND_NUM_ARGS();
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sZ|s", &str, &str_len, &from, &to, &to_len) == FAILURE) {
@@ -2833,7 +2831,7 @@ static int php_similar_char(const char *txt1, int len1, const char *txt2, int le
PHP_FUNCTION(similar_text)
{
char *t1, *t2;
- zval **percent;
+ zval **percent = NULL;
int ac = ZEND_NUM_ARGS();
int sim;
int t1_len, t2_len;
@@ -3610,7 +3608,7 @@ static void php_str_replace_in_subject(zval *search, zval *replace, zval **subje
*/
static void php_str_replace_common(INTERNAL_FUNCTION_PARAMETERS, int case_sensitivity)
{
- zval **subject, **search, **replace, **subject_entry, **zcount;
+ zval **subject, **search, **replace, **subject_entry, **zcount = NULL;
zval *result;
char *string_key;
uint string_key_len;
@@ -4702,7 +4700,7 @@ PHP_FUNCTION(strnatcasecmp)
PHP_FUNCTION(substr_count)
{
char *haystack, *needle;
- long offset = 0, length;
+ long offset = 0, length = 0;
int ac = ZEND_NUM_ARGS();
int count = 0;
int haystack_len, needle_len;
@@ -4944,7 +4942,7 @@ PHP_FUNCTION(str_shuffle)
PHP_FUNCTION(str_word_count)
{
char *buf, *str, *char_list = NULL, *p, *e, *s, ch[256];
- int str_len, char_list_len, word_count = 0;
+ int str_len, char_list_len = 0, word_count = 0;
long type = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len, &type, &char_list, &char_list_len) == FAILURE) {
diff --git a/ext/standard/type.c b/ext/standard/type.c
index e4632add20..ca5bf0d40c 100644
--- a/ext/standard/type.c
+++ b/ext/standard/type.c
@@ -356,7 +356,7 @@ PHP_FUNCTION(is_scalar)
Returns true if var is callable. */
PHP_FUNCTION(is_callable)
{
- zval *var, **callable_name;
+ zval *var, **callable_name = NULL;
char *name;
zend_bool retval;
zend_bool syntax_only = 0;
diff --git a/ext/standard/versioning.c b/ext/standard/versioning.c
index 719c56b76a..08b65d697c 100644
--- a/ext/standard/versioning.c
+++ b/ext/standard/versioning.c
@@ -210,8 +210,8 @@ php_version_compare(const char *orig_ver1, const char *orig_ver2)
PHP_FUNCTION(version_compare)
{
- char *v1, *v2, *op;
- int v1_len, v2_len, op_len;
+ char *v1, *v2, *op = NULL;
+ int v1_len, v2_len, op_len = 0;
int compare, argc;
argc = ZEND_NUM_ARGS();