Doc #81028 [Com]: touch() with wrappers

[email protected] ("alisauxsabpn53 at gmail dot com") Sat, 10 Dec 2022 10:12:55 +0000
Newsgroups php.doc.bugs
Message-ID <[email protected]>
Edit report at https://bugs.php.net/bug.php?id=81028&edit=1

 ID:                 81028
 Comment by:         alisauxsabpn53 at gmail dot com
 Reported by:        sh-ya at ya dot ru
 Summary:            touch() with wrappers
 Status:             Verified
 Type:               Documentation Problem
 Package:            Documentation problem
 PHP Version:        7.4.19
 Block user comment: N
 Private report:     N

 New Comment:

Thanks for sharing that. (https://my-accountaccess.com/)github.com


Previous Comments:
------------------------------------------------------------------------
[2021-05-11 21:36:12] [email protected]

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>

------------------------------------------------------------------------
[2021-05-10 19:22:45] 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)


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81028&edit=1