From:             n0spam_socrate_omega at hotmail dot com
Operating system: Windows XP Home/Pro
PHP version:      4.3.4
PHP Bug Type:     Arrays related
Bug description:  End of an array created by explode corrupted

Description:
------------
I have a string encrypted with mcrypt and encoded in base64. I unbase64
this string and I decrypt it using mcrypt. I got the exact same string but
when I try to explode it into an array with the explode() function, I
cannot make comparison == with the last element of the newly created
array.

Reproduce code:
---------------
$key = "validkey";
$input = base64_decode($txtEncrypted);  
$decrypted = mcrypt_ecb(MCRYPT_RIJNDAEL_128, $key, $input,
MCRYPT_DECRYPT);

echo $decrypted."<br>";

$array_data = explode('||', $decrypted);

echo "|".$array_data."|<br>";

if ($array_data[8] == 'end') {
   echo "it works!";
}

Expected result:
----------------
data||ddata||daata||dadta||dasta||datad||daata||datsa||end
|end|
it works!

Actual result:
--------------
data||ddata||daata||dadta||dasta||datad||daata||datsa||end
|end|


-- 
Edit bug report at http://bugs.php.net/?id=26733&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26733&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26733&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26733&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26733&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26733&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=26733&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=26733&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26733&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26733&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26733&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26733&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26733&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26733&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26733&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26733&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26733&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26733&r=float

Reply via email to