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
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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

Add a Patch

Pull Requests

Add a Pull Request

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>
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Fri Aug 12 15:03:36 2022 UTC