[php-src] PR #12587: Make `php -a` history conform to XDG Base Directory Specification
| From: | paulfedorow | Date: | Wed, 01 Nov 2023 14:09:32 +0000 |
| Subject: | [php-src] PR #12587: Make `php -a` history conform to XDG Base Directory Specification | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-24077@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/12587
Author: paulfedorow
Resolves GH-8546.
To keep existing installations working the code first checks if a history file already exists at
~/.php_history. If it does, then everything works as before.
If ~/.php_history does not exist, we check whether the system supports the XDG Base
Directory Specification. If it doesn't we continue using ~/.php_history;
otherwise, we use a path that conforms to the XDG Base Directory Specification.
We detect support for XDG Base Directory Specification by checking for environment variables that
start with the XDG_ prefix. This is analogous to what Composer does:
https://github.com/composer/composer/pull/1407
The specification can be found here:
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
Suggestions on how to implement automated tests for this are welcome. :smile_cat: