[php-src] PR #19912: ftp: use int for sent to preserve SSL_write()

From: Date: Mon, 22 Sep 2025 07:37:26 +0000
Subject: [php-src] PR #19912: ftp: use int for sent to preserve SSL_write()
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-33296@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/19912 Author: zeff-ir ### What is fixed SSL_write() returns int and uses negative values to indicate errors. The variable sent in ext/ftp/ftp.c was declared as size_t, which caused negative return values to be converted into large positive numbers. ### Why it matters Although this value is later passed to SSL_get_error(), the OpenSSL API requires the original return value of SSL_write() to be used. Passing a converted unsigned value may lead to incorrect error handling and potentially report a failed write as a success. ### Why change is safe While the implicit int → size_t → int conversion is “usually” safe on most compilers, it relies on implementation-defined behavior. Using a signed int makes the code clearer, avoids subtle portability issues, and directly matches the return type contract of SSL_write(). ### How it is fixed Changed the type of sent from size_t to int.

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