pH-7/Obfuscator-Class

Using with PHP 7.1

oleteacher opened this issue · 6 comments

I had used your class months back but was on PHP 5.6, all seemed to work fine. Really enjoyed how simple to use.

Trying today on PHP 7.1.10 and getting errors like:

PHP Parse error: syntax error, unexpected '<' end of file

runtime-created function(1): eval()'d code (148): runtime-created function(1): eval()'d code on line 1

Any ideas if this is related to PHP 7? The script I am encrypting is only a simple config file like:

<?php 
$about = "About Us";
$abouttxt = "Working for Kids Worldwide!";
$url = "http://example.com";
?>

Not using the <?php tags of course:)

Thank you!

Susan

pH-7 commented

Hi @oleteacher
Thanks for your issue. Should work fine with PHP 7.*

Please see the examples
https://github.com/pH-7/Obfuscator-Class#example-1

pH-7 commented

I tested your code on a PHP 7.1 environment and works well

test.php

<?php
ini_set('display_errors', 1);
require 'Obfuscator.class.php';

$sData = <<<'DATA'
    $about = "About Us";
    $abouttxt = "Working for Kids Worldwide!";
    $url = "http://example.com";
    echo $about;
    echo '<br />';
    echo $abouttxt;
    echo '<br />';
    echo $url;
DATA;

$sObfusationData = new Obfuscator($sData, 'Kids Worldwide');
file_put_contents('my_obfuscated_data.php', '<?php ' . "\r\n" . $sObfusationData);

Obfuscator.class.php class should be located in the same folder

Then, you will get my_obfuscated_data.php file.

Then, go execute it (through your web browser for instance), you should see the following:

About Us
Working for Kids Worldwide!
http://example.com
pH-7 commented

@oleteacher Let me know if any further questions. Thanks for using my script!

pH-7 commented

@oleteacher FYI, I cleaned up the class (better indentation) and add a note on README file saying it works also with PHP 7+

Ok @pH-7 , thank you. Must be something else on my end. Working for me in php 5.6 but not php 7.1.

Appreciate you taking time to respond.

I have the same problem. Even simple php with echo does this.