Why is stdout not a tty, even though stderr is? Please let me know if you need more context, added this line to pass stackoverflow’s validation.
$ php -r 'var_dump(exec("test -t 1 && echo y"));'
string(0) ""
$ php -r 'var_dump(system("test -t 1 && echo y"));'
string(0) ""
$ php -r 'var_dump(passthru("test -t 1 && echo y"));'
NULL
$ php -r 'var_dump(exec("test -t 2 && echo y"));'
string(1) "y"
$ php -r 'var_dump(system("test -t 2 && echo y"));'
y
string(1) "y"
$ php -r 'var_dump(passthru("test -t 2 && echo y"));'
y
NULL
$ php -v
PHP 8.2.20 (cli) (built: Jul 4 2024 02:23:40) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.20, Copyright (c) Zend Technologies
$ uname -rsm
FreeBSD 13.3-RELEASE-p1 amd64