#63711 closed enhancement (fixed)
Adopt standard get_temp_dir() in Text_Diff
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | minor | Version: | 6.9 |
| Component: | External Libraries | Keywords: | has-patch |
| Focuses: | Cc: |
Description
This is designed to place files in a potentially different place than the rest of WordPress, and its potential false return value is not checked by the only caller in Text_Diff_Engine_shell.
Change History (6)
This ticket was mentioned in PR #9276 on WordPress/wordpress-develop by @TimoTijhof.
7 months ago
#2
- Keywords has-patch added
This was placing files in a potentially different place than the rest of WordPress, and its potential false return value was not checked by the only caller in Text_Diff_Engine_shell.
I considered changing our get_temp_dir implementations to check the additional directories that Text_Diff::_getTempDir considered, but decided against it. The Text_Diff code predates the introduction of sys_get_temp_dir in PHP 5.2, and so is checking these to make up for that. The latest version of the code that this was based on no longer does this and calls sys_get_temp_dir instead. Specifically, it removed _getTempDir in favor of tempnam(null) [1], and later switched to horde/util, [2] which uses sys_get_temp_dir. [3]
[1]: https://github.com/horde/Text_Diff/commit/323c4783b9
[2]: https://github.com/horde/Text_Diff/commit/152f6aacf8
[3]: https://github.com/horde/Util/blob/v2.5.12/lib/Horde/Util.php#L200
Trac ticket: https://core.trac.wordpress.org/ticket/63711
Related:
I note that it appears to be impossible to use this code in practice because "auto" chooses between the faster php-xdiff extension and fallback/native PHP code. To use it, one would need to use
new Text_Diff('shell')or construct the Text_Diff_Engine_shell class directly. Are these two classes considered a public stable API for plugin/theme authors? If not, I could instead remove that part of it.