php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #81028 touch() with wrappers
Submitted: 2021-05-10 19:22 UTC Modified: 2021-05-11 21:36 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: sh-ya at ya dot ru Assigned:
Status: Verified Package: Documentation problem
PHP Version: 7.4.19 OS:
Private report: No CVE-ID: None
 [2021-05-10 19:22 UTC] sh-ya at ya dot ru
Description:
------------
it seems we can check URLs with touch(), but it's undocumented.

Test script:
---------------
var_dump(touch('https://bugs.php.net/'), touch('https://bugs.php.net/null'));

Actual result:
--------------
bool(true)
bool(false)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-05-11 21:36 UTC] cmb@php.net
-Status: Open +Status: Verified
 [2021-05-11 21:36 UTC] cmb@php.net
Frankly, that[1] looks like a bug to me (albeit one we should not
fix in a revision, and perhaps not in a minor).  touch() is
supposed to modify the atime (even when called without parameter),
and to create the file if it does not exist, but that certainly
won't work for HTTP URLs (and generally not for non writable
wrappers).

[1] <https://github.com/php/php-src/blob/php-7.4.19/ext/standard/filestat.c#L671>
[2] <https://www.php.net/manual/en/function.touch.php#refsect1-function.touch-description>
 [2022-12-10 10:12 UTC] alisauxsabpn53 at gmail dot com
Thanks for sharing that. (https://my-accountaccess.com/)github.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC