[php-src] PR #25467: Fix posix_ttyname() returning the stdin terminal for an invalid argument type

From: Date: Sun, 15 Nov 2026 16:22:26 +0000
Subject: [php-src] PR #25467: Fix posix_ttyname() returning the stdin terminal for an invalid argument type
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-40656@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25467 Author: lacatoire After warning that the argument is neither an int nor a resource, posix_ttyname() converted it with zval_get_long(). A string, array or object therefore became file descriptor 0 or 1, and the function returned the name of the terminal. Return false after the warning instead, as posix_isatty() already does. To reproduce, in a terminal: ```php var_dump(posix_ttyname('abc')); ``` Before: ``` Warning: posix_ttyname(): Argument #1 ($file_descriptor) must be of type int|resource, string given in %s on line %d string(10) "/dev/pts/0" ``` After: ``` Warning: posix_ttyname(): Argument #1 ($file_descriptor) must be of type int|resource, string given in %s on line %d bool(false) ```

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