note 129236 added to function.touch

From: Date: Sun, 11 Feb 2024 22:32:11 +0000
Subject: note 129236 added to function.touch
Groups: php.notes 
Request: Send a blank email to php-notes+get-221190@lists.php.net to get a copy of this message
I have found out that setting a negative *mtime* deletes the file. The following code always deletes the file at $path while $touch returns true. <?php $path = '/folder/file'; $timestamp = -1; $touch = touch($path, $timestamp); ?> Running PHP 7.4.5 ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.131 (proxied: 109.80.12.204) ---- Manual Page -- https://php.net/manual/en/function.touch.php Edit -- https://main.php.net/note/edit/129236 Del: integrated -- https://main.php.net/note/delete/129236/integrated Del: useless -- https://main.php.net/note/delete/129236/useless Del: bad code -- https://main.php.net/note/delete/129236/bad+code Del: spam -- https://main.php.net/note/delete/129236/spam Del: non-english -- https://main.php.net/note/delete/129236/non-english Del: in docs -- https://main.php.net/note/delete/129236/in+docs Del: other reasons-- https://main.php.net/note/delete/129236 Reject -- https://main.php.net/note/reject/129236 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221190) next »