Content-Length: 299113 | pFad | https://github.com/symfony/symfony/pull/57614

77 Remove useless `uniqid` in tempnam calls in tests by GromNaN · Pull Request #57614 · symfony/symfony · GitHub
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.

nicolas-grekas added a commit that referenced this pull request Jul 22, 2025
…ate snapshots anymore (KevinVanSonsbeek)

This PR was merged into the 7.2 branch.

Discussion
----------

[Config] Fix GeneratedConfigTest not being able to generate snapshots anymore

| Q             | A
| ------------- | ---
| Branch?       | 7.2
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Issues        | Fix #61139
| License       | MIT

PR #57614 Removed multiple uses of `uniqid`. In the specific PR changes were made to the GeneratedConfigTest, to change how the directory was built for the config.

This inadvertedly broke the generating of snapshot files, due to the outputDir being changed to a by reference argument, and always overwriting the value to a temp dir. (While the snapshot files should not be written to a temp dir)

Commits
-------

8e8daf1 bugfix(#61139): Only generate an outputDir if none is set.
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








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/symfony/symfony/pull/57614

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy