Skip to content

Remove useless uniqid in tempnam calls in tests #57614

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

Merged
merged 1 commit into from
Jul 1, 2024

Conversation

GromNaN
Copy link
Member

@GromNaN GromNaN commented Jul 1, 2024

Q A
Branch? 7.2
Bug fix? no
New feature? no
Deprecations? no
Issues Part of #57588
License MIT

For creating a temporary directory, I use tempnam then remove the file and create the directory with the same name.

@GromNaN GromNaN requested a review from derrabus July 1, 2024 08:23
@carsonbot carsonbot added this to the 7.2 milestone Jul 1, 2024
@nicolas-grekas
Copy link
Member

Thank you @GromNaN.

@nicolas-grekas nicolas-grekas merged commit 8a4899d into symfony:7.2 Jul 1, 2024
10 of 11 checks passed
@GromNaN GromNaN deleted the tempnam-uniqid branch July 1, 2024 09:00
@TimWolla
Copy link
Contributor

TimWolla commented Jul 1, 2024

For creating a temporary directory, I use tempnam then remove the file and create the directory with the same name.

Note that this usage is not safe in the general case: The filename might be reused between the call to unlink() and the call to mkdir(), causing mkdir() to fail.

For tests it's probably fine, but for production code it would requiring handling the mkdir() failure and trying again.

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.

4 participants