New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: allow to change ~/.php_history with PHP_HISTFILE #13964
Conversation
Related: #8546 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @spk! Looks reasonable in general.
1b9dfc5
to
055fd8a
Compare
sapi/cli/tests/017.phpt
Outdated
$dir = PHP_OS_FAMILY == 'Windows' ? getenv("USERPROFILE") : getenv("HOME"); | ||
var_dump(file_exists($dir . '/.php_history')); | ||
|
||
define("TMPDIR", __DIR__ . "/"); | ||
$php_history_tmp = TMPDIR . "php_history"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use $php_history_tmp = tempnam(sys_get_temp_dir(), 'php_history');
to avoid having to clean up the file and putting it in the ignore list.
Edit: Or just sys_get_temp_dir() . '/php_history'
, as tempnam
will create an empty file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks i've applied the changes, current CI failure doesn't look related
ee1a2e0
to
609429d
Compare
Merged as 3f0b204. (Linked the wrong PR...) |
Thank you @spk! |
why
Allow to change .php_history repl file with PHP_HISTFILE environment variable
how
If the env var is present use it first then fallback to HOME or USERPROFILE on windows
(i'm not a C developer any help/feedback welcome thanks)