Measuring Proposal Reaction

php.internals

Jesse G. Donat

3 years ago
I'm looking to measure reaction to a proposal. My proposal is to have the STDOUT and STDERR global constants always defined rather than just when running via CLI. The variability of their existence is a common cause of confusion for younger inexperienced devs, and even something that slips the mind of more experienced developers. My team actually internally has a sniff forbidding STDOUT and STDERR due to their unreliability in favor of fopenening php://stdout / php://stdout I think removing the environment variability between CLI and Web outweighs the potential problems of people writing to these in the wrong contexts, especially given that you can already fopen and fwrite to standard out and standard error from a web session. This is only my second RFC I've purprosed so I'm pretty new to the process. Let me know what you think and what I can do to help Thanks, Jesse G. Donat

Larry Garfield

3 years ago
On Tue, Jan 17, 2023, at 1:25 PM, Jesse G. Donat wrote:
> I'm looking to measure reaction to a proposal. > > My proposal is to have the STDOUT and STDERR global constants always > defined rather than just when running via CLI. > > The variability of their existence is a common cause of confusion for > younger inexperienced devs, and even something that slips the mind of more > experienced developers. > > My team actually internally has a sniff forbidding STDOUT and STDERR due to > their unreliability in favor of fopenening php://stdout / php://stdout > > I think removing the environment variability between CLI and Web > outweighs the potential problems of people writing to these in the wrong > contexts, especially given that you can already fopen and fwrite to > standard out and standard error from a web session. > > This is only my second RFC I've purprosed so I'm pretty new to the process. > Let me know what you think and what I can do to help > > Thanks, > > Jesse G. Donat
Does anyone know why those constants are left out? Given that the functionality can still be used, as noted... --Larry Garfield

Christian Schneider

3 years ago
> Am 18.01.2023 um 23:29 schrieb Larry Garfield <larry@garfieldtech.com>: > On Tue, Jan 17, 2023, at 1:25 PM, Jesse G. Donat wrote: >> I'm looking to measure reaction to a proposal. >> >> My proposal is to have the STDOUT and STDERR global constants always >> defined rather than just when running via CLI. > > Does anyone know why those constants are left out? Given that the functionality can still be used, as noted...
I could imagine old code checking if STDOUT/STDERR is defined to determine if they are running in CLI. While there are now other ways to do it it would probably be a minor BC break to now defined them. Turning the question around: As there is already a way of accessing STDOUT/STDERR with php://, should we introduce a BC break? Side-note: If we decide to now define the constant for all SAPIs, should defined('STDOUT') etc. throw some sort of warning so code checking for it can be found more easily? - Chris