Skip to content

Conversation

@spk
Copy link
Contributor

@spk spk commented Apr 15, 2024

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)

@ranvis
Copy link
Contributor

ranvis commented Apr 15, 2024

Related: #8546

Copy link
Member

@iluuu1994 iluuu1994 left a 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.

@spk spk force-pushed the php-histfile-env branch 2 times, most recently from 1b9dfc5 to 055fd8a Compare April 17, 2024 09:50
@spk spk force-pushed the php-histfile-env branch from 055fd8a to 638e711 Compare April 17, 2024 11:48
@spk spk requested a review from iluuu1994 April 17, 2024 12:22
var_dump(file_exists($dir . '/.php_history'));

define("TMPDIR", __DIR__ . "/");
$php_history_tmp = TMPDIR . "php_history";
Copy link
Member

@iluuu1994 iluuu1994 Apr 18, 2024

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.

Copy link
Contributor Author

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

@spk spk force-pushed the php-histfile-env branch 2 times, most recently from ee1a2e0 to 609429d Compare April 19, 2024 09:18
@spk spk force-pushed the php-histfile-env branch from 609429d to 6d3610f Compare April 22, 2024 07:55
@iluuu1994
Copy link
Member

Merged as 3f0b204. (Linked the wrong PR...)

@iluuu1994 iluuu1994 closed this Apr 22, 2024
@iluuu1994
Copy link
Member

Thank you @spk!

@spk spk deleted the php-histfile-env branch April 22, 2024 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants