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 4621670
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:44:04+00:00 2026-05-22T02:44:04+00:00

In my previous post i ask how to create variables from an array (

  • 0

In my previous post i ask how to create variables from an array ( PHP Variables made with foreach ) i got several answers and i was testing extract() but i have seen several against it for security reasons.

Now my question here is how can i use extract in a secure way from a $_POST that has an array that was made using jquery serialized.

With secure i mean that if a user inputs the wrong data, the secure way can take care of that with no problems.

THe PHP Site has a small warning in the extract command the says the following:

Do not use extract() on untrusted
data, like user input (i.e. $_GET,
$_FILES, etc.). If you do, for example
if you want to run old code that
relies on register_globals
temporarily, make sure you use one of
the non-overwriting extract_type
values such as EXTR_SKIP and be aware
that you should extract in the same
order that’s defined in
variables_order within the php.ini.

It warns about the use but does not provide an example at least of how to solve the user of extract in a secure way.

  • 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-22T02:44:05+00:00Added an answer on May 22, 2026 at 2:44 am

    The best option is to not use extract() at all. It’s a bad design decision from the days when PHP was the equivalent of wet toilet paper for writing secure code.

    It may be painful, but it is far better to write out a long sequence of:

    $var1 = $_POST['var1'];
    $var2 = $_POST['var2'];
    etc...
    

    or simply use $_POST['var1'] and company everywhere in your code.

    As soon as you start using extract, you’re giving malicious users a potential way into your code, no matter how much time/effort you put into it. You don’t drill a hole through a bank vault door because it’s too annoying to have to open the door each time to let some money out. Once there’s a hole, it will be exploited.

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

Sidebar

Related Questions

I have this function from a plugin (from a previous post) // This method
After seeing a previous post Making Applications programmed in .NET languages work on older
This question is related to a previous post of mine Here . Basically, I
As an addition to my previous post on Creating a web server in pure
After I messed up the description of my previous post on this I have
I'm experiencing the same problem in this previous stackoverflow.com post . Specifically, I seem
In previous releases there were 3 ways to pass data from controller to view
I'm having some trouble with the idea of accessing variables from other classes. I
I have tried to ask a variant of this question before. I got some
In previous versions of jQuery tabs there was an option to automatically set the

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.