Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

--TEST-- Test array_map() function : usage variations - failing built-in functions & langu..

Decoded Output download

*** Testing array_map() : non-permmited built-in functions ***
-- Iteration 1 --

Did this file decode correctly?

Original Code

--TEST--
Test array_map() function : usage variations - failing built-in functions & language constructs
--FILE--
<?php
/*
 * Test array_map() by passing non-permmited built-in functions and language constructs i.e.
 *   echo(), array(), empty(), eval(), exit(), isset(), list(), print()
 */

echo "*** Testing array_map() : non-permmited built-in functions ***\n";

// array to be passed as arguments
$arr1 = array(1, 2);

// built-in functions & language constructs
$callback_names = array(
/*1*/  'echo',
       'array',
       'empty',
/*4*/  'eval',
       'exit',
       'isset',
       'list',
/*8*/  'print'
);
for($count = 0; $count < count($callback_names); $count++)
{
    echo "-- Iteration ".($count + 1)." --\n";
    try {
        var_dump( array_map($callback_names[$count], $arr1) );
    } catch (TypeError $e) {
        echo $e->getMessage(), "\n";
    }
}

echo "Done";
?>
--EXPECT--
*** Testing array_map() : non-permmited built-in functions ***
-- Iteration 1 --
array_map(): Argument #1 ($callback) must be a valid callback or null, function "echo" not found or invalid function name
-- Iteration 2 --
array_map(): Argument #1 ($callback) must be a valid callback or null, function "array" not found or invalid function name
-- Iteration 3 --
array_map(): Argument #1 ($callback) must be a valid callback or null, function "empty" not found or invalid function name
-- Iteration 4 --
array_map(): Argument #1 ($callback) must be a valid callback or null, function "eval" not found or invalid function name
-- Iteration 5 --
array_map(): Argument #1 ($callback) must be a valid callback or null, function "exit" not found or invalid function name
-- Iteration 6 --
array_map(): Argument #1 ($callback) must be a valid callback or null, function "isset" not found or invalid function name
-- Iteration 7 --
array_map(): Argument #1 ($callback) must be a valid callback or null, function "list" not found or invalid function name
-- Iteration 8 --
array_map(): Argument #1 ($callback) must be a valid callback or null, function "print" not found or invalid function name
Done

Function Calls

count 1

Variables

$arr1 [{'key': 0, 'value': 1}, {'key': 1, 'value': 2}]
$count 0
$callback_names [{'key': 0, 'value': 'echo'}, {'key': 1, 'value': 'array'}, {'key': 2, 'value': 'empty'}, {'key': 3, 'value': 'eval'}, {'key': 4, 'value': 'exit'}, {'key': 5, 'value': 'isset'}, {'key': 6, 'value': 'list'}, {'key': 7, 'value': 'print'}]

Stats

MD5 b2dcc51f447c212b14dc2964230c5bd3
Eval Count 0
Decode Time 106 ms