Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@ static bucket_compare_func_t php_get_data_compare_func_unstable(zend_long sort_t

PHPAPI zend_long php_count_recursive(HashTable *ht) /* {{{ */
{
zend_long cnt = 0;
zend_long cnt;
zval *element;

#ifdef ZEND_CHECK_STACK_LIMIT
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/dns.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,7 +822,7 @@ PHP_FUNCTION(dns_get_record)
HEADER *hp;
querybuf answer = {0};
uint8_t *cp = NULL, *end = NULL;
int n, qd, an, ns = 0, ar = 0;
int n, qd, an, ns, ar;
int type, first_query = 1, store_results = 1;
bool raw = 0;

Expand Down
5 changes: 1 addition & 4 deletions ext/standard/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ PHPAPI int php_exec(int type, const char *cmd, zval *array, zval *return_value)
FILE *fp;
char *buf;
int pclose_return;
char *b, *d=NULL;
char *b;
php_stream *stream;
size_t buflen, bufl = 0;
#if PHP_SIGCHILD
Expand Down Expand Up @@ -184,9 +184,6 @@ PHPAPI int php_exec(int type, const char *cmd, zval *array, zval *return_value)
signal(SIGCHLD, sig_handler);
}
#endif
if (d) {
efree(d);
}
return pclose_return;
err:
pclose_return = -1;
Expand Down
1 change: 0 additions & 1 deletion ext/standard/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@ PHP_FUNCTION(file_put_contents)
}
mode[0] = 'c';
}
mode[2] = '\0';

stream = php_stream_open_wrapper_ex(filename, mode, ((flags & PHP_FILE_USE_INCLUDE_PATH) ? USE_PATH : 0) | REPORT_ERRORS, NULL, context);
if (stream == NULL) {
Expand Down
1 change: 0 additions & 1 deletion ext/standard/filestat.c
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,6 @@ PHP_FUNCTION(chown)
#ifdef HAVE_LCHOWN
PHP_FUNCTION(lchown)
{
RETVAL_TRUE;
php_do_chown(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
#endif
Expand Down
28 changes: 5 additions & 23 deletions ext/standard/ftp_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa
/* Append */
memcpy(tmp_line, "APPE", sizeof("APPE"));
}
php_stream_printf(stream, "%s %s\r\n", tmp_line, (resource->path != NULL ? ZSTR_VAL(resource->path) : "/"));
php_stream_printf(stream, "%s %s\r\n", tmp_line, ZSTR_VAL(resource->path));

/* open the data channel */
if (hoststart == NULL) {
Expand Down Expand Up @@ -734,7 +734,7 @@ static php_stream * php_stream_ftp_opendir(php_stream_wrapper *wrapper, const ch
goto opendir_errexit;
}

php_stream_printf(stream, "NLST %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/"));
php_stream_printf(stream, "NLST %s\r\n", ZSTR_VAL(resource->path));

result = GET_FTP_RESULT(stream);
if (result != 150 && result != 125) {
Expand Down Expand Up @@ -800,7 +800,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url,
}

ssb->sb.st_mode = 0644; /* FTP won't give us a valid mode, so approximate one based on being readable */
php_stream_printf(stream, "CWD %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/")); /* If we can CWD to it, it's a directory (maybe a link, but we can't tell) */
php_stream_printf(stream, "CWD %s\r\n", ZSTR_VAL(resource->path)); /* If we can CWD to it, it's a directory (maybe a link, but we can't tell) */
result = GET_FTP_RESULT(stream);
if (result < 200 || result > 299) {
ssb->sb.st_mode |= S_IFREG;
Expand All @@ -816,7 +816,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url,
goto stat_errexit;
}

php_stream_printf(stream, "SIZE %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/"));
php_stream_printf(stream, "SIZE %s\r\n", ZSTR_VAL(resource->path));
result = GET_FTP_RESULT(stream);
if (result < 200 || result > 299) {
/* Failure either means it doesn't exist
Expand All @@ -831,7 +831,7 @@ static int php_stream_ftp_url_stat(php_stream_wrapper *wrapper, const char *url,
ssb->sb.st_size = atoi(tmp_line + 4);
}

php_stream_printf(stream, "MDTM %s\r\n", (resource->path != NULL ? ZSTR_VAL(resource->path) : "/"));
php_stream_printf(stream, "MDTM %s\r\n", ZSTR_VAL(resource->path));
result = GET_FTP_RESULT(stream);
if (result == 213) {
char *p = tmp_line + 4;
Expand Down Expand Up @@ -920,12 +920,6 @@ static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, const char *url, i
goto unlink_errexit;
}

if (resource->path == NULL) {
php_stream_wrapper_warn(wrapper, context, options, InvalidPath,
"Invalid path provided in %s", url);
goto unlink_errexit;
}

/* Attempt to delete the file */
php_stream_printf(stream, "DELE %s\r\n", ZSTR_VAL(resource->path));

Expand Down Expand Up @@ -1051,12 +1045,6 @@ static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, in
goto mkdir_errexit;
}

if (resource->path == NULL) {
php_stream_wrapper_warn(wrapper, context, options, InvalidPath,
"Invalid path provided in %s", url);
goto mkdir_errexit;
}

if (!recursive) {
php_stream_printf(stream, "MKD %s\r\n", ZSTR_VAL(resource->path));
result = GET_FTP_RESULT(stream);
Expand Down Expand Up @@ -1140,12 +1128,6 @@ static int php_stream_ftp_rmdir(php_stream_wrapper *wrapper, const char *url, in
goto rmdir_errexit;
}

if (resource->path == NULL) {
php_stream_wrapper_warn(wrapper, context, options, InvalidPath,
"Invalid path provided in %s", url);
goto rmdir_errexit;
}

php_stream_printf(stream, "RMD %s\r\n", ZSTR_VAL(resource->path));
result = GET_FTP_RESULT(stream);

Expand Down
3 changes: 0 additions & 3 deletions ext/standard/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ PHPAPI void php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
if (ZSTR_VAL(key)[0] == '\0' && type != NULL) {
const char *tmp;
zend_unmangle_property_name_ex(key, &tmp, &prop_name, &prop_len);
} else {
prop_name = ZSTR_VAL(key);
prop_len = ZSTR_LEN(key);
}
} else {
prop_name = NULL;
Expand Down
7 changes: 3 additions & 4 deletions ext/standard/http_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ static bool php_stream_http_response_header_trim(char *http_header_line,
size_t *http_header_line_length)
{
char *http_header_line_end = http_header_line + *http_header_line_length - 1;
while (http_header_line_end >= http_header_line &&
while (http_header_line_end >= http_header_line &&
(*http_header_line_end == '\n' || *http_header_line_end == '\r')) {
http_header_line_end--;
}
Expand Down Expand Up @@ -985,7 +985,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
} else {
last_line = false;
}

if (last_header_line_str != NULL) {
/* Parse last header line. */
last_header_line_str = php_stream_http_response_headers_parse(wrapper, stream,
Expand Down Expand Up @@ -1072,8 +1072,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
}
}
s[1] = '\0';
if (resource->path &&
ZSTR_VAL(resource->path)[0] == '/' &&
if (ZSTR_VAL(resource->path)[0] == '/' &&
ZSTR_VAL(resource->path)[1] == '\0') {
spprintf(&loc_path, 0, "%s%s", ZSTR_VAL(resource->path), header_info.location);
} else {
Expand Down
2 changes: 0 additions & 2 deletions ext/standard/image.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ static struct php_gfxinfo *php_handle_swc(php_stream * stream)
php_swf_get_bits (b, 5, bits)) / 20;
result->height = (php_swf_get_bits (b, 5 + (3 * bits), bits) -
php_swf_get_bits (b, 5 + (2 * bits), bits)) / 20;
} else {
result = NULL;
}

efree (b);
Expand Down
6 changes: 1 addition & 5 deletions ext/standard/pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -1287,11 +1287,7 @@ PHP_FUNCTION(unpack)
x = php_pack_reverse_int64(x);
}

if (type == 'q') {
v = (int64_t) x;
} else {
v = x;
}
v = x;

ZVAL_LONG(&val, v);
break;
Expand Down
4 changes: 1 addition & 3 deletions ext/standard/pageinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@
/* {{{ php_statpage */
PHPAPI void php_statpage(void)
{
zend_stat_t *pstat = NULL;

pstat = sapi_get_stat();
zend_stat_t *pstat = sapi_get_stat();

if (BG(page_uid)==-1 || BG(page_gid)==-1) {
if(pstat) {
Expand Down
10 changes: 5 additions & 5 deletions ext/standard/password.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void php_password_algo_unregister(const char *ident) {

static int php_password_salt_to64(const char *str, const size_t str_len, const size_t out_len, char *ret) /* {{{ */
{
size_t pos = 0;
size_t pos;
zend_string *buffer;
if ((int) str_len < 0) {
return FAILURE;
Expand Down Expand Up @@ -101,7 +101,7 @@ static zend_string* php_password_make_salt(size_t length) /* {{{ */
}
/* }}} */

static zend_string* php_password_get_salt(zval *unused_, size_t required_salt_len, HashTable *options) {
static zend_string* php_password_get_salt(size_t required_salt_len, HashTable *options) {
if (options && zend_hash_str_exists(options, "salt", sizeof("salt") - 1)) {
php_error_docref(NULL, E_WARNING, "The \"salt\" option has been ignored, since providing a custom salt is no longer supported");
}
Expand Down Expand Up @@ -194,7 +194,7 @@ static zend_string* php_password_bcrypt_hash(const zend_string *password, zend_a
}

hash_format_len = snprintf(hash_format, sizeof(hash_format), "$2y$%02" ZEND_LONG_FMT_SPEC "$", cost);
if (!(salt = php_password_get_salt(NULL, Z_UL(22), options))) {
if (!(salt = php_password_get_salt(Z_UL(22), options))) {
return NULL;
}
ZSTR_VAL(salt)[ZSTR_LEN(salt)] = 0;
Expand Down Expand Up @@ -303,7 +303,7 @@ static zend_string *php_password_argon2_hash(const zend_string *password, zend_a
size_t memory_cost = PHP_PASSWORD_ARGON2_MEMORY_COST;
size_t threads = PHP_PASSWORD_ARGON2_THREADS;
size_t encoded_len;
int status = 0;
int status;

if (options && (option_buffer = zend_hash_str_find(options, "memory_cost", sizeof("memory_cost")-1)) != NULL) {
memory_cost = zval_get_long(option_buffer);
Expand Down Expand Up @@ -332,7 +332,7 @@ static zend_string *php_password_argon2_hash(const zend_string *password, zend_a
return NULL;
}

if (!(salt = php_password_get_salt(NULL, Z_UL(16), options))) {
if (!(salt = php_password_get_salt(Z_UL(16), options))) {
return NULL;
}

Expand Down
2 changes: 0 additions & 2 deletions ext/standard/streamsfuncs.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,7 @@ PHP_FUNCTION(stream_socket_server)

if (stream == NULL) {
php_error_docref(NULL, E_WARNING, "Unable to connect to %s (%s)", host, errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr));
}

if (stream == NULL) {
if (zerrno) {
ZEND_TRY_ASSIGN_REF_LONG(zerrno, err);
}
Expand Down
6 changes: 0 additions & 6 deletions ext/standard/string.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,6 @@ PHP_FUNCTION(wordwrap)
if (breakchar_len == 1 && !docut) {
newtext = zend_string_init(ZSTR_VAL(text), ZSTR_LEN(text), 0);

laststart = lastspace = 0;
for (current = 0; current < (zend_long)ZSTR_LEN(text); current++) {
if (ZSTR_VAL(text)[current] == breakchar[0]) {
laststart = lastspace = current + 1;
Expand Down Expand Up @@ -785,7 +784,6 @@ PHP_FUNCTION(wordwrap)
/* now keep track of the actual new text length */
newtextlen = 0;

laststart = lastspace = 0;
for (current = 0; current < (zend_long)ZSTR_LEN(text); current++) {
if (chk == 0) {
alloced += (size_t) (((ZSTR_LEN(text) - current + 1)/linelength + 1) * breakchar_len) + 1;
Expand Down Expand Up @@ -2288,10 +2286,6 @@ PHP_FUNCTION(chunk_split)
RETURN_NEW_STR(result);
}

if (!ZSTR_LEN(str)) {
RETURN_EMPTY_STRING();
}

result = php_chunk_split(ZSTR_VAL(str), ZSTR_LEN(str), end, endlen, (size_t)chunklen);

RETURN_STR(result);
Expand Down
4 changes: 0 additions & 4 deletions ext/standard/strnatcmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ compare_right(char const **a, char const *aend, char const **b, char const *bend
bias = +1;
}
}

return 0;
}
/* }}} */

Expand All @@ -79,8 +77,6 @@ compare_left(char const **a, char const *aend, char const **b, char const *bend)
else if (**a > **b)
return +1;
}

return 0;
}
/* }}} */

Expand Down
1 change: 0 additions & 1 deletion ext/standard/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ PHPAPI php_url *php_url_parse_ex2(char const *str, size_t length, bool *has_port
goto parse_port;
} else if (s + 1 < ue && *s == '/' && *(s + 1) == '/') { /* relative-scheme URL */
s += 2;
e = 0;
goto parse_host;
} else {
goto just_path;
Expand Down
1 change: 0 additions & 1 deletion ext/standard/user_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ static ZEND_RSRC_DTOR_FUNC(php_bucket_dtor)
php_stream_bucket *bucket = (php_stream_bucket *)res->ptr;
if (bucket) {
php_stream_bucket_delref(bucket);
bucket = NULL;
}
}

Expand Down
2 changes: 1 addition & 1 deletion ext/standard/var.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static void zval_object_property_dump(zend_property_info *prop_info, zval *zv, z

PHPAPI void php_debug_zval_dump(zval *struc, int level) /* {{{ */
{
HashTable *myht = NULL;
HashTable *myht;
zend_string *class_name;
zend_ulong index;
zend_string *key;
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/versioning.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ static int compare_special_version_forms(char *form1, char *form2)
};
special_forms_t *pp;

for (pp = special_forms; pp && pp->name; pp++) {
for (pp = special_forms; pp->name; pp++) {
if (strncmp(form1, pp->name, pp->name_len) == 0) {
found1 = pp->order;
break;
}
}
for (pp = special_forms; pp && pp->name; pp++) {
for (pp = special_forms; pp->name; pp++) {
if (strncmp(form2, pp->name, pp->name_len) == 0) {
found2 = pp->order;
break;
Expand Down
Loading