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

  • SEARCH
  • Home
  • 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 4244678
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T03:44:23+00:00 2026-05-21T03:44:23+00:00

I admit the title is mostly a catch 22, but it’s entirely relevant, so

  • 0

I admit the title is mostly a catch 22, but it’s entirely relevant, so please bear with me for a while…

Background

As some may know, I’m working on a PHP framework whose major selling point is that of bridging functionality between different CMSes/systems.
From a developer perspective, there’s an extensive error handling and logging mechanism.
Right now, there are two settings, DEBUG_MODE and DEBUG_VERBOSE, which control debug output.

The mode describes the medium and verbose controls the amount of detail.
To make it short, there’s a mode called “console” which basically dumps debug info into the javascript console (which is now available in a major web browser near you).

The Issue

This [debug system] works great for development servers, but you absolutely cannot use it on a production one since debug details (which include DB credentials etc) get published publicly. And in all honesty, who ever migrated from a dev. to a prod. server flawlessly each time?

Solutions

Therefore, I’ve been trying to figure out a way to fix this. Among my proposed solutions are:

  • Having a setting which tells the framework to enable logging only if the request comes from a certain IP. The security issues for this are quite obvious (IP spoofing among others).
  • Having a setting which contains PHP expression(code) that gets eval’d and it’s return used as a yes/no. The best part is that the framework installed may suggest CMS-specific expressions, eg:
    • WordPress: current_user_can('manage_options')
    • Joomla: $user=&JFactory::getUser() && ($user->usertype=='Super Administrator') || ($user->usertype=='Administrator')
    • Custom: $_SERVER['REMOTE_ADDR']=='123.124.125.126'
  • These are among the two, I’m eager to hear out more suggestions.

So, do you think eval() should be up to it? I’ll ensure it still performs well by only doing this once per page load/request.

Clarification

if(DEBUG_MODE!='none')echo 'Debug'; // this is how it is now
if(DEBUG_MODE!='none' && $USER_CONDITION)echo 'Debug'; // this is how it should be

The $USER_CONDITON allows stuff such as running is_admin() to allow all admins to see debug info, or, getUser()->id==45 to enable it for a specific user. Or by IP, or whatever.

enter image description here

  • 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-21T03:44:24+00:00Added an answer on May 21, 2026 at 3:44 am

    Go ahead. It’s evident that you understand the hypothetical security implications. In your case it’s just important to tell the target user base about it.

    As for the practicability of your approach, there’s no discussion really. You need variable authentication logic and can’t hardwire it to one specific environment/cms runtime.

    The only concern you see is about performance. That’s baloney. Not an issue. The presence of eval is what discerns scripting languages from compiled languages. If it’s available you can not only use it, but can be sure that it’s not going to be slow because a compiler+linker run is required behind the scenes. PHP takes some time with initializing its tokenizer and parser, but parsing itself is surprisingly quick.

    And lastly, avoid such question titles on SO. ;} Or at the very least talk about create_function please.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I admit it is not the best title, but I don't know how to
I admit its not very clear title. But I did not know how else
I'll admit the title is a bit confusing but it was hard to come
I admit, I don't know too much about javascript, mostly I just steal and
Okay, I'll admit - the title is not the most descriptive/helpful but I couldn't
Terrible title, I know... This works and gives me what I'm looking for, but
I admit it: I don't bother with too much exception handling. I know I
Background I admit, this question stems from an ultimate lack of deep understanding of
I'll admit I'm rubbish at regular expressions and find some of the tools out
Willing to admit I'm a complete .NET newbie, but I have extensive experience in

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.