This post is dedicated to a simple but tricky gotcha in the WordPress plugin Ultimate Member. For those of you who may be unfamiliar with Ultimate Member it is a plugin that adds enhanced user account management abilities to your WordPress site. Put simply the plugin allows you to:
The list really could go on and on but suffice it to say that Ultimate Member adds a lot of free functionality to your WordPress site. If you manage a big WordPress site the paid extensions can take your site even further; I’m being serious, this is not a paid post, I really love what Ultimate Member is doing for WordPress.
The PHP manual on chmod has a subtle little warning about providing a decimal number instead of an octal when calling the chmod function:
Mode is not automatically assumed to be an octal value, so to ensure the expected operation, you need to prefix mode with a zero (0).
So what does this warning really mean and more importantly what is a programmer to do when allowing users to input the mode themselves? Besides shouting out never allow the user to do this! and calling it case closed, I would like to show you what you can do to solve this problem and a legitimate reason why you might use this solution in your application.
This has been a very eventful week and a very successful one as far as my programming career goes. Besides the post I put up a few days ago, Knowing when it’s time to toss code out!, I also stumbled on to a bug that turned out not to be a bug and figured I should share.
As a precursor to this article, and your going to have to take my word on this since I can’t find the original article, I’m fairly certain I was taught self revealing modules incorrectly from some programmers blog post. He seemed so knowledgeable.