[GIT-PULLS] [php-src] PR #23386: SAPI: Convert sapi_getenv to zend_string

[email protected] (NattyNarwhal)
Newsgroups php.git-pulls
Message-ID <[email protected]>
Pull Request: https://github.com/php/php-src/pull/23386
Author: NattyNarwhal

The old char* return was very ambigious at the SAPI level about ownership per platform (unix returned environ buffer, Win32 returned converted buffer), which it then estrduped at the SAPI frontend level. To clarify this, instead return an allocated zend_string in the SAPIs which we bubble up to consumers.

There are some annoyances still; input filters have to shuffle some buffers because input filters expect to work on raw buffers, and phar does some mildly harrowing string mangling without zend_string. These should be cleaned up.

There is also the question if SAPIs just bubbling up getenv when they lack a web server specific context i.e. from fcgi or Apache  (CGI, FPM, Litespeed), as this seems not quite the right intent; CLI doesn't implement a getenv function for instance.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.