Skip to content

Commit cfba9cd

Browse files
committed
Merge branch 'PHP-8.2'
* PHP-8.2: Propagate success status of ftp_close() to userland
2 parents 02e8c16 + 4c2ee6f commit cfba9cd

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

ext/ftp/php_ftp.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,19 +1216,20 @@ PHP_FUNCTION(ftp_close)
12161216
{
12171217
zval *z_ftp;
12181218
php_ftp_object *obj;
1219+
bool success = true;
12191220

12201221
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &z_ftp, php_ftp_ce) == FAILURE) {
12211222
RETURN_THROWS();
12221223
}
12231224

12241225
obj = ftp_object_from_zend_object(Z_OBJ_P(z_ftp));
12251226
if (obj->ftp) {
1226-
ftp_quit(obj->ftp);
1227+
success = ftp_quit(obj->ftp);
12271228
ftp_close(obj->ftp);
12281229
obj->ftp = NULL;
12291230
}
12301231

1231-
RETURN_TRUE;
1232+
RETURN_BOOL(success);
12321233
}
12331234
/* }}} */
12341235

ext/ftp/tests/004.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ bool(true)
2828

2929
Warning: ftp_login(): Not logged in. in %s on line %d
3030
bool(false)
31-
bool(true)
31+
bool(false)

ext/ftp/tests/server.inc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ if ($pid) {
183183
fputs($s, "200 OK\r\n");
184184

185185
} elseif ($buf === "QUIT\r\n") {
186+
fputs($s, "221 Bye\r\n");
186187
break;
187188

188189
} elseif (preg_match("~^PORT (\d+),(\d+),(\d+),(\d+),(\d+),(\d+)\r\n$~", $buf, $m)) {

0 commit comments

Comments
 (0)