Any string starting with underscore '_' will be replaced.
maciejkrol opened this issue · 3 comments
maciejkrol commented
Example code:
/*global console*/
(function () {
'use strict';
var var1 = 'this is correct';
var var2 = '_this will be encoded';
var var3 = 'and _here as _well.';
console.log(var1);
console.log(var2);
console.log(var3);
}());
When obfuscated using:
$packer = new \Tholu\Packer\Packer($script, 'Normal', true, true, true);
$script = $packer->pack();
Gives this output when run:
this is correct
_0 will be encoded
and _1 as _2.
This is highly undesired and caused me a lot of troubles.
tholu commented
This is intended behavior if the $specialChars
option is set, try this instead:
$packer = new \Tholu\Packer\Packer($script, 'Normal', true, false, true);
maciejkrol commented
Ok I made some more experiments to understand that. However, this still seems to be a bit strange for me.
tholu commented
@maciejkrol This is by design (see http://dean.edwards.name/packer/2/usage/ for a better explanation), however I did not design this library - I just packaged it.