]> granicus.if.org Git - php/commitdiff
Fix a bunch of binary/unicode issues in the mcrypt tests
authorRasmus Lerdorf <rasmus@php.net>
Sun, 26 Jul 2009 08:13:40 +0000 (08:13 +0000)
committerRasmus Lerdorf <rasmus@php.net>
Sun, 26 Jul 2009 08:13:40 +0000 (08:13 +0000)
ext/mcrypt/tests/bug41252.phpt
ext/mcrypt/tests/mcrypt_cbc.phpt
ext/mcrypt/tests/mcrypt_cbf.phpt
ext/mcrypt/tests/mcrypt_decrypt.phpt
ext/mcrypt/tests/mcrypt_ecb.phpt
ext/mcrypt/tests/mcrypt_list_modes.phpt
ext/mcrypt/tests/mcrypt_ofb.phpt

index b184f800f5fa2698e751480b71eb5c9cba5c7fe7..f360d1debf37cad994544e8b60879c76eed81403 100644 (file)
@@ -5,7 +5,7 @@ Bug #41252 (Calling mcrypt_generic without first calling mcrypt_generic_init cra
 --FILE--
 <?php
 $td = mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, '');
-echo mcrypt_generic($td,'aaaaaaaa');
+echo mcrypt_generic($td,b'aaaaaaaa');
 print "I'm alive!\n";
 ?>
 --EXPECTF--
index 43b50ab211c0f3997ec6b2ee8cc443d2237ce6cb..dd352c1ae50fcb3a9e0723f5abd479060155c660 100644 (file)
@@ -4,8 +4,8 @@ mcrypt_cbc
 <?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
 --FILE--
 <?php
-$key      = "FooBar";
-$secret   = "PHP Testfest 2008";
+$key      = b"FooBar";
+$secret   = b"PHP Testfest 2008";
 $cipher   = MCRYPT_RIJNDAEL_128;
 
 $iv       = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);
index ebc2834aba1eae27169b0da887544d6d1141e26e..0e1f358c44f06ef0e16b7bb9766b270708599d92 100644 (file)
@@ -4,8 +4,8 @@ mcrypt_cbf
 <?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
 --FILE--
 <?php
-$key      = "FooBar";
-$secret   = "PHP Testfest 2008";
+$key      = b"FooBar";
+$secret   = b"PHP Testfest 2008";
 $cipher   = MCRYPT_RIJNDAEL_128;
 
 $iv       = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);
index 498762bc8987d38b2d24a4e5edd5df8e7cb6215a..9fb9f69ddce330934fd7e7cca7a11b19f8f938a7 100644 (file)
@@ -4,8 +4,8 @@ mcrypt_decrypt
 <?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
 --FILE--
 <?php
-$key      = "FooBar";
-$secret   = "PHP Testfest 2008";
+$key      = b"FooBar";
+$secret   = b"PHP Testfest 2008";
 $mode     = MCRYPT_MODE_CBC;
 $cipher   = MCRYPT_RIJNDAEL_128;
 
@@ -18,7 +18,7 @@ echo trim(mcrypt_decrypt($cipher, $key, $enc_data, $mode, $iv)) . "\n";
 // a warning must be issued if we don't use a IV on a AES cipher, that usually requires an IV
 mcrypt_decrypt($cipher, $key, $enc_data, MCRYPT_MODE_CBC);
 
-var_dump(strpos(mcrypt_decrypt(MCRYPT_BLOWFISH, "FooBar", $enc_data, MCRYPT_MODE_CBC, $iv), "Testfest") !== false);
+var_dump(strpos(mcrypt_decrypt(MCRYPT_BLOWFISH, b"FooBar", $enc_data, MCRYPT_MODE_CBC, $iv), b"Testfest") !== false);
 --EXPECTF--
 PHP Testfest 2008
 
index fc54516e4245c3b94a19770f3d32f585f5de5bb9..fcaf1c06377b7dea14979ee27d4a32631f0b2062 100644 (file)
@@ -4,8 +4,8 @@ mcrypt_ecb
 <?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
 --FILE--
 <?php
-$key      = "FooBar";
-$secret   = "PHP Testfest 2008";
+$key      = b"FooBar";
+$secret   = b"PHP Testfest 2008";
 $cipher   = MCRYPT_RIJNDAEL_128;
 
 $iv       = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);
index 4b9fa7938f6a92b91f4d9398380d9e301e801945..1996866aab10a358ef180f663b57e76a67f2eddf 100644 (file)
@@ -8,19 +8,19 @@ var_dump(mcrypt_list_modes());
 --EXPECT--
 array(8) {
   [0]=>
-  string(3) "cbc"
+  unicode(3) "cbc"
   [1]=>
-  string(3) "cfb"
+  unicode(3) "cfb"
   [2]=>
-  string(3) "ctr"
+  unicode(3) "ctr"
   [3]=>
-  string(3) "ecb"
+  unicode(3) "ecb"
   [4]=>
-  string(4) "ncfb"
+  unicode(4) "ncfb"
   [5]=>
-  string(4) "nofb"
+  unicode(4) "nofb"
   [6]=>
-  string(3) "ofb"
+  unicode(3) "ofb"
   [7]=>
-  string(6) "stream"
+  unicode(6) "stream"
 }
index 0ed1e191d2c185ab2c77506afddce23099d0118a..348a5ff8689e571f6c356cac065e337ddf0add2f 100644 (file)
@@ -4,8 +4,8 @@ mcrypt_ofb
 <?php if (!extension_loaded("mcrypt") || unicode_semantics()) print "skip"; ?>
 --FILE--
 <?php
-$key      = "FooBar";
-$secret   = "PHP Testfest 2008";
+$key      = b"FooBar";
+$secret   = b"PHP Testfest 2008";
 $cipher   = MCRYPT_RIJNDAEL_128;
 
 $iv       = mcrypt_create_iv(mcrypt_get_iv_size($cipher, MCRYPT_MODE_ECB), MCRYPT_RAND);