Doc #55566 [Opn]: Example 2 for fileperms is wrong

From: Date: Thu, 01 Sep 2011 16:10:21 +0000
Subject: Doc #55566 [Opn]: Example 2 for fileperms is wrong
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-7106@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=55566&edit=1 ID: 55566 User updated by: david dot gero at ec dot gc dot ca Reported by: david dot gero at ec dot gc dot ca Summary: Example 2 for fileperms is wrong Status: Open Type: Documentation Problem Package: Documentation problem Operating System: Irrelevant PHP Version: Irrelevant Block user comment: N Private report: N New Comment: Sorry, should have been $pinfo = substr("upcudubu-ulusuuu", (($perms >> 12) & 0xF), 1); Previous Comments: ------------------------------------------------------------------------ [2011-09-01 16:08:00] david dot gero at ec dot gc dot ca Or how about just $pinfo = substr("upcudubu-ulusuuu", (($perms >> 24) & 0xF), 1); ------------------------------------------------------------------------ [2011-09-01 15:58:20] david dot gero at ec dot gc dot ca Description: ------------ --- From manual page: http://www.php.net/function.fileperms --- The first section of example 2, where it is checking for file type, is wrong. It should be using (($perms & 0xF000) == 0xC000), (($perms & 0xF000) == 0xA000), (($perms & 0xF000) == 0x8000), etc. Even better, why not make it a switch on ($perms & 0xF000) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55566&edit=1

« previous php.doc.bugs (#7106) next »