Skip to content

Remove unnecessary checks in ftp_fopen_wrapper.c #10711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2023
Merged
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
10 changes: 4 additions & 6 deletions ext/standard/ftp_fopen_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char
return stream;

connect_errexit:
if (resource) {
php_url_free(resource);
}
php_url_free(resource);

if (stream) {
php_stream_close(stream);
Expand Down Expand Up @@ -916,7 +914,7 @@ static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, const char *url, i
}

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

result = GET_FTP_RESULT(stream);
if (result < 200 || result > 299) {
Expand Down Expand Up @@ -979,7 +977,7 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_fr
}

/* Rename FROM */
php_stream_printf(stream, "RNFR %s\r\n", (resource_from->path != NULL ? ZSTR_VAL(resource_from->path) : "/"));
php_stream_printf(stream, "RNFR %s\r\n", ZSTR_VAL(resource_from->path));

result = GET_FTP_RESULT(stream);
if (result < 300 || result > 399) {
Expand All @@ -990,7 +988,7 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_fr
}

/* Rename TO */
php_stream_printf(stream, "RNTO %s\r\n", (resource_to->path != NULL ? ZSTR_VAL(resource_to->path) : "/"));
php_stream_printf(stream, "RNTO %s\r\n", ZSTR_VAL(resource_to->path));

result = GET_FTP_RESULT(stream);
if (result < 200 || result > 299) {
Expand Down