[php-src] PR #23540: ext/ftp: declare the false returned by ftp_nb_fget() and ftp_nb_fput()

From: Date: Wed, 02 Sep 2026 11:52:24 +0000
Subject: [php-src] PR #23540: ext/ftp: declare the false returned by ftp_nb_fget() and ftp_nb_fput()
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-38263@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/23540 Author: lacatoire ftp_nb_fget() and ftp_nb_fput() are declared int, but both answer an already busy connection with false: ```c if (ftp->in_use) { php_error_docref(NULL, E_WARNING, "FTP\\Connection is already in use"); RETURN_FALSE; } ``` ftp_nb_get() and ftp_nb_put() carry the same guard and already declare int|false; the two stream variants were left behind. Internal functions do not coerce their return value, so a caller hitting the guard receives false against a declaration promising int, and === FTP_FAILED (integer 0) does not match it. ftp_nb_continue() has no such guard — every exit is a RETURN_LONG — so it stays int. Only the declarations change. in_use is set and cleared within a single engine call, so the guard is reachable through re-entrancy alone and nothing at runtime moves. The added test reads the declared types of all five ftp_nb_* functions and needs no FTP server.

« previous php.git-pulls (#38263) next »