Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The function create_function has been DEPRECATED in PHP 8 #24

Open
BaseMax opened this issue May 10, 2021 · 1 comment
Open

The function create_function has been DEPRECATED in PHP 8 #24

BaseMax opened this issue May 10, 2021 · 1 comment

Comments

@BaseMax
Copy link
Contributor

BaseMax commented May 10, 2021

Hi Pierre;

The Function create_function has been DEPRECATED in PHP8 and encoded programs will not run in a new server.
(PHP 4 >= 4.0.1, PHP 5, PHP 7)

Warning: This function has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0. Relying on this function is highly discouraged. https://www.php.net/manual/en/function.create-function.php

$__________________ = 'Q1JFQXRlX2Z1bkNUaU9u';
$__________________ = $__($__________________);
// print $__________________."\n";
// $__________________ = "create_function";

Trace

[max@workstation Obfuscator-Class]$ php 2-input.php

CREAte_funCTiOn
PHP Fatal error:  Uncaught Error: Call to undefined function CREAte_funCTiOn() in /project/Obfuscator-Class/2-input.php:18
Stack trace:
#0 {main}
  thrown in /project/Obfuscator-Class/2-input.php on line 18

[max@workstation Obfuscator-Class]$ php 2-input.php

PHP Fatal error:  Uncaught Error: Call to undefined function create_function() in /project/Obfuscator-Class/2-input.php:21
Stack trace:
#0 {main}
  thrown in /project/Obfuscator-Class/2-input.php on line 21

What I find is obscured code want to use CREAte_funCTiOn function somethings is probably create_function. But this is not available in server.

$ php -v

PHP 8.0.5 (cli) (built: Apr 27 2021 18:07:13) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.5, Copyright (c) Zend Technologies

I'm not sure it's solved before or a trick and solution to solve this. Anyway I submit this since I see encoded programs cannot run anymore.

Best;

@konstantinosbotonakis
Copy link

konstantinosbotonakis commented Aug 2, 2021

Try this:

if (!function_exists("create_function)) { function __create_function($arg, $body) { static $cache = array(); static $maxCacheSize = 64;

static $sorter;

if ($sorter === NULL) {
    $sorter = function($a, $b) {
        if ($a->hits == $b->hits) {
            return 0;
        }

        return ($a->hits < $b->hits) ? 1 : -1;
    };
}

$crc = crc32($arg . "\\x00" . $body);

if (isset($cache[$crc])) {
    ++$cache[$crc][1];
    return $cache[$crc][0];
}

if (sizeof($cache) >= $maxCacheSize) {
    uasort($cache, $sorter);
    array_pop($cache);
}

$cache[$crc] = array($cb = eval('return function('.$arg.'){'.$body.'};'), 0);
return $cb; } }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants