note 109274 added to function.unlink
| From: | adam at digitalization dot nl | Date: | Sun, 01 Jul 2012 22:51:43 +0000 |
| Subject: | note 109274 added to function.unlink | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188994@lists.php.net to get a copy of this message | ||
Be careful. Apparently unlink() has the power to delete entire folders INCLUDING files under some
circumstances.
Usually functions with a loop are created to actually delete entire folders with files, but today I
observed and confirmed that passing a directory name to unlink caused a folder and all images it
contained to be deleted.
So make sure to use an is_dir() check or other checks to make sure you this doesn't happen to
you by accident.
This was observed on 5.3.2-1ubuntu4.17.
----
Server IP: 69.147.83.197
Probable Submitter: 122.59.248.227
----
Manual Page -- http://www.php.net/manual/en/function.unlink.php
Edit -- https://master.php.net/note/edit/109274
Del: integrated -- https://master.php.net/note/delete/109274/integrated
Del: useless -- https://master.php.net/note/delete/109274/useless
Del: bad code -- https://master.php.net/note/delete/109274/bad+code
Del: spam -- https://master.php.net/note/delete/109274/spam
Del: non-english -- https://master.php.net/note/delete/109274/non-english
Del: in docs -- https://master.php.net/note/delete/109274/in+docs
Del: other reasons-- https://master.php.net/note/delete/109274
Reject -- https://master.php.net/note/reject/109274
Search -- https://master.php.net/manage/user-notes.php