rfc:tempnam-suffix-v2
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
rfc:tempnam-suffix-v2 [2023/08/03 03:10] – created athos | rfc:tempnam-suffix-v2 [2023/08/27 01:45] (current) – athos | ||
---|---|---|---|
Line 3: | Line 3: | ||
* Date: 2023-08-02 | * Date: 2023-08-02 | ||
* Author: Athos Ribeiro, athoscribeiro@gmail.com | * Author: Athos Ribeiro, athoscribeiro@gmail.com | ||
- | * Status: | + | * Status: |
* First Published at: http:// | * First Published at: http:// | ||
* Based on work by Stefan Neufeind, neufeind@php.net at https:// | * Based on work by Stefan Neufeind, neufeind@php.net at https:// | ||
Line 36: | Line 36: | ||
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== | ||
- | None with exception of changing the signature of the php_do_open_temporary_file function, which is not exported. | + | None with exception of changing the signature of the internal |
===== Proposed PHP Version(s) ===== | ===== Proposed PHP Version(s) ===== | ||
- | next PHP 8.x". | + | next PHP 8.x. |
===== RFC Impact ===== | ===== RFC Impact ===== | ||
Line 47: | Line 47: | ||
===== Open Issues ===== | ===== Open Issues ===== | ||
- | - The **tempnam** **prefix** paramter is sanitized through the **basename** function when path separators are present in the provided string, using only the last part of the provided path. For instance, **foo/bar** would become **bar**. We could not find the historical reasons for the **prefix** parameter to behave as described, but for consistency, | + | |
- | - Only the 63 first characters passed to the **prefix** paramter are used. Although we could not find the historical reasons behind this decision, we are currently replicating the behavior for the new **suffix** parameter. | + | |
- | - **In windows systems**, none of the characters passed as a suffix will be appended to the file name (i.e., **the suffix parameter will be ignored**). This is due to the underlying function (and API) used to generate temporary files, which do not provide means to set a suffix. While we could provide a custom implementation (which could be proposed in a future RFC to provide more consistency for tempnam), the current windows API being used includes a .TMP extension to the generated files, which AFAICT, does matter in windows systems. I also found a related discussion in an old bug at https:// | + | |
===== Unaffected PHP Functionality ===== | ===== Unaffected PHP Functionality ===== | ||
Line 55: | Line 53: | ||
===== Future Scope ===== | ===== Future Scope ===== | ||
+ | |||
+ | The **tempnam** **prefix** paramter is sanitized through the **basename** function when path separators are present in the provided string, using only the last part of the provided path. For instance, **foo/bar** would become **bar**. We could not find the historical reasons for the **prefix** parameter to behave as described, but for consistency, | ||
+ | |||
+ | Moreover,o nly the 63 first characters passed to the **prefix** paramter are used. Although we could not find the historical reasons behind this decision, we are currently replicating the behavior for the new **suffix** parameter. | ||
+ | |||
+ | Finally, **In windows systems**, none of the characters passed as a suffix will be appended to the file name (i.e., **the suffix parameter will be ignored**). This is due to the underlying function (and API) used to generate temporary files, which do not provide means to set a suffix. While we could provide a custom implementation, | ||
+ | |||
+ | Therefore, the following changes are left for future work: | ||
+ | |||
+ | * Re-visit tempnam' | ||
+ | * Re-visit tempnam' | ||
* Re-work tempnam' | * Re-work tempnam' | ||
+ | |||
+ | The first two could be part of a minor refactoring effort for tempnam. The last one, however, should be part of a major refactoring effort for tempnam. | ||
===== Proposed Voting Choices ===== | ===== Proposed Voting Choices ===== | ||
Line 66: | Line 77: | ||
===== Implementation ===== | ===== Implementation ===== | ||
- | TBD | + | As linked above |
+ | |||
+ | ===== Vote ===== | ||
+ | |||
+ | <doodle title=" | ||
+ | * Yes | ||
+ | * No | ||
+ | </ | ||
===== References ===== | ===== References ===== |
rfc/tempnam-suffix-v2.1691032244.txt.gz · Last modified: 2023/08/03 03:10 by athos