[php-src] PR #23386: SAPI: Convert sapi_getenv to zend_string
| From: | NattyNarwhal | Date: | Wed, 19 Aug 2026 17:15:44 +0000 |
| Subject: | [php-src] PR #23386: SAPI: Convert sapi_getenv to zend_string | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-38017@lists.php.net to get a copy of this message | ||
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.