How php disables eval () function instances

Source: Internet
Author: User

How php disables eval () function instances

Php eval () function Operation Array:

<? Php $ data = "array ('key1' => 'value1', 'key2' => 'value2', 'key3' => 'value3 ', 'key4' => 'value4 ') "; $ arr = eval (" return $ data; "); var_dump ($ arr); // array?>

Running result:

Array (4) {["key1"] => string (6) "value1" ["key2"] => string (6) "value2" ["key3"] => string (6) "value3" ["key4"] => string (6) "value4 "}

On the Internet, it is often said that disable_functions is used to disable eval!

In fact, eval () cannot be disabled by disable_functions in php. ini:

Because eval () is a language construct and not a function

Eval is zend, so it is not a PHP_FUNCTION;

So how does php disable eval?

If you want to disable eval, you can use php extension Suhosin:

After suhosinis installed, load suhosin.soin php.ini, and add suhosin.exe cutor. disable_eval = on.

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.