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-- Bug #61038: unpack("a5", "str\0\0") does not work as expected --FILE-- <?php var_..

Decoded Output download

--TEST--
Bug #61038: unpack("a5", "str") does not work as expected
--FILE--
<?php
var_dump(unpack("a4", "str"));
var_dump(unpack("a5", "str"));
var_dump(unpack("a6", "str"));
var_dump(unpack("a*", "str"));
?>
--EXPECTF--
array(1) {
  [1]=>
  string(4) "str%c"
}
array(1) {
  [1]=>
  string(5) "str%c%c"
}

Warning: unpack(): Type a: not enough input, need 6, have 5 in %s on line %d
bool(false)
array(1) {
  [1]=>
  string(5) "str%c%c"
}

Did this file decode correctly?

Original Code

--TEST--
Bug #61038: unpack("a5", "str\0\0") does not work as expected
--FILE--
<?php
var_dump(unpack("a4", "str\0\0"));
var_dump(unpack("a5", "str\0\0"));
var_dump(unpack("a6", "str\0\0"));
var_dump(unpack("a*", "str\0\0"));
?>
--EXPECTF--
array(1) {
  [1]=>
  string(4) "str%c"
}
array(1) {
  [1]=>
  string(5) "str%c%c"
}

Warning: unpack(): Type a: not enough input, need 6, have 5 in %s on line %d
bool(false)
array(1) {
  [1]=>
  string(5) "str%c%c"
}

Function Calls

unpack 1

Variables

None

Stats

MD5 699acc8b74a4c60877a5f236a274a4ad
Eval Count 0
Decode Time 90 ms