Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6714109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:27:27+00:00 2026-05-26T08:27:27+00:00

Found this bit of code in FrogCms function isWritable($file=null) { $perms = fileperms($file); if

  • 0

Found this bit of code in FrogCms

function isWritable($file=null) {
  $perms = fileperms($file);
  if (is_writable($file) || ($perms & 0x0080) || ($perms & 0x0010) || ($perms & 0x0002))
    return true;
}

I had a hard time understanding this part

(is_writable($file) || ($perms & 0x0080) || ($perms & 0x0010) || ($perms & 0x0002))

After doing some research i know that 0x0080 is permission for owner, 0x0010 is permission for group and 0x0002 is permission for other.Where do this value come form? Is this is a predetermined value for permission system?

And can someone explain to me for example how $perms & 0x0080 resolve to true, cause for example fileperms(__FILE__) return a value like 33206.How can u
compare 33206 with 0x0080?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T08:27:28+00:00Added an answer on May 26, 2026 at 8:27 am

    The constants you refer to (0x0080 etc) do not have the exact meanings you think they do. See the fileperms documentation:

    0x0080 = owner writable
    0x0010 = group writable
    0x0002 = world writable
    

    Also, you are not comparing them, you are performing a bitwise AND.

        1000000110110110 = 33206 (dec)
        0000000010000000 = 0x80  (hex)
    AND ------------------------
        0000000010000000 = result (bin)
    

    Since the result is non-zero, this means that the particular file is owner-writable.

    But what does the code you give do?

    Well, it returns true if and only if the file is writable by any of the following:

    • the user that the script runs as (checked by is_writable)
    • the user that owns the file
    • the group that owns the file
    • any user

    This certainly looks like illogical and buggy to me, because e.g.:

    • if e.g. only the owner can write the file the function will return true; however, that certainly does not mean the file is writable for you, unless you are the owner!
    • if the aim is to check if anyone could write the file (which is kind of pointless really), the is_writable check would be superfluous and at the very least confusing.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this bit of code I found on the web at the end
I've recently added this little bit of code to my .htaccess file: RewriteCond %{REQUEST_FILENAME}
I found this code online and tweaked it a bit for my need to
I found this bit of code whist searching for a basic slider and its
I found this bit of code on stackoverflow at Best practices on displaying search
I found this little bit of code in a project: if ($(.c1 .c2).is(:hidden)){ $(.c1).hide();
I found this useful bit of code among the series of tubes that is
I've found this useful bit of code that allows uk dates to work in
I have found this bit of web.config code for checking the url to see
Okay, I have done a bit of searching online and found this thread, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.