N
NemoBlack
Guest
I'm doing a Perl script to perform a deflate in Perl so I can test in PHP, the perl result works fine but when I try In PHP the resulting code I receive the error "Warning: gzinflate(): data error in C:\xampp\htdocs\test.php on line 3"
Source
use MIME::Base64;
use Compress::Zlib;
my $php_code = "<?php echo 'hi world'; ?>"; #FAIL
#my $php_code = "echo 'hi world';"; FAIL
print "Original : ".$php_code."\n\n";
my $buffer;
my $d = deflateInit();
$buffer = $d->deflate($php_code);
$buffer .= $d->flush();
print "After Encoded Base64 : ".$buffer."\n\n"; #
my $encoded = encode_base64($buffer,"");
print "Encoded : ".$encoded."\n\n";
$encoded = decode_base64($encoded);
#
print "After Decoded Base64 : ".$encoded."\n\n"; #
my $decoded;
my $i = inflateInit();
while ($encoded) {
$decoded .= $i->inflate($encoded);
}
print "Decoded : ".$decoded."\n\n";
Output
Original : <?php echo 'hi world'; ?>
After Encoded Base64 : x£│▒/╚(PHM╬╚WP¤╚T(¤/╩IQÀV░À♥ jñÔ
Encoded : eJyzsS/IKFBITc7IV1DPyFQozy/KSVG3VrC3AwBqpAfi
After Decoded Base64 : x£│▒/╚(PHM╬╚WP¤╚T(¤/╩IQÀV░À♥ jñÔ
Decoded : <?php echo 'hi world'; ?>
PHP Source
<?php
$uncompressed = gzinflate(base64_decode("eJyzsS/IKFBITc7IV1DPyFQozy/KSVG3VrC3AwBqpAfi"));
eval($uncompressed);
?>
Output
Warning: gzinflate(): data error in C:\xampp\htdocs\test.php on line 3
I try removing Tags but the same error continues
How do I fix this error?
Continue reading...
Source
use MIME::Base64;
use Compress::Zlib;
my $php_code = "<?php echo 'hi world'; ?>"; #FAIL
#my $php_code = "echo 'hi world';"; FAIL
print "Original : ".$php_code."\n\n";
my $buffer;
my $d = deflateInit();
$buffer = $d->deflate($php_code);
$buffer .= $d->flush();
print "After Encoded Base64 : ".$buffer."\n\n"; #
my $encoded = encode_base64($buffer,"");
print "Encoded : ".$encoded."\n\n";
$encoded = decode_base64($encoded);
#
print "After Decoded Base64 : ".$encoded."\n\n"; #
my $decoded;
my $i = inflateInit();
while ($encoded) {
$decoded .= $i->inflate($encoded);
}
print "Decoded : ".$decoded."\n\n";
Output
Original : <?php echo 'hi world'; ?>
After Encoded Base64 : x£│▒/╚(PHM╬╚WP¤╚T(¤/╩IQÀV░À♥ jñÔ
Encoded : eJyzsS/IKFBITc7IV1DPyFQozy/KSVG3VrC3AwBqpAfi
After Decoded Base64 : x£│▒/╚(PHM╬╚WP¤╚T(¤/╩IQÀV░À♥ jñÔ
Decoded : <?php echo 'hi world'; ?>
PHP Source
<?php
$uncompressed = gzinflate(base64_decode("eJyzsS/IKFBITc7IV1DPyFQozy/KSVG3VrC3AwBqpAfi"));
eval($uncompressed);
?>
Output
Warning: gzinflate(): data error in C:\xampp\htdocs\test.php on line 3
I try removing Tags but the same error continues
How do I fix this error?
Continue reading...