]> granicus.if.org Git - php/commitdiff
Fix tests
authorHenrique do Nascimento Angelo <hnangelo@php.net>
Sat, 19 Jul 2008 00:02:46 +0000 (00:02 +0000)
committerHenrique do Nascimento Angelo <hnangelo@php.net>
Sat, 19 Jul 2008 00:02:46 +0000 (00:02 +0000)
ext/openssl/tests/003.phpt
ext/openssl/tests/012.phpt
ext/openssl/tests/023.phpt
ext/openssl/tests/025.phpt
ext/openssl/tests/bug37820.phpt
ext/openssl/tests/bug38255.phpt
ext/openssl/tests/bug38261.phpt

index 939de51bf5b9fce4d0341712dab6964d6142a7c0..cfaffe41126d2638fea930aaff019aa3e93358ef 100644 (file)
@@ -19,7 +19,7 @@ var_dump(openssl_pkcs7_decrypt($a, $b, $c, $d));
 var_dump($c);
 
 var_dump(openssl_pkcs7_decrypt($b, $b, $b, $b));
-var_dump(openssl_pkcs7_decrypt($a, $b, "", ""));
+var_dump(openssl_pkcs7_decrypt($a, $b, b"", b""));
 var_dump(openssl_pkcs7_decrypt($a, $b, true, false));
 var_dump(openssl_pkcs7_decrypt($a, $b, 0, 0));
 
index 52009806019e84cd912870669fcbb923413c6fab..1df2f159436b6a468fcc619816b36ee62a0f1718 100644 (file)
@@ -8,7 +8,7 @@ $data = b"openssl_open() test";
 $pub_key = "file://" . dirname(__FILE__) . "/public.key";
 $wrong = "wrong";
 
-openssl_seal($data, $sealed, $ekeys, array($pub_key));
+openssl_seal($data, $sealed, $ekeys, array($pub_key));                  // no output
 openssl_seal($data, $sealed, $ekeys, array($pub_key, $pub_key));        // no output
 openssl_seal($data, $sealed, $ekeys, array($pub_key, $wrong));
 openssl_seal($data, $sealed, $ekeys, array($pub_key, (binary)$wrong));
@@ -19,6 +19,8 @@ openssl_seal($data, $sealed, $ekeys, array($wrong));
 ?>
 --EXPECTF--
 
+Warning: openssl_seal(): Binary string expected, Unicode string received in %s on line %d
+
 Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
 
 Warning: openssl_seal(): not a public key (2th member of pubkeys) in %s on line %d
@@ -29,5 +31,7 @@ Warning: openssl_seal() expects parameter 4 to be array, binary string given in
 
 Warning: openssl_seal(): Fourth argument to openssl_seal() must be a non-empty array in %s on line %d
 
+Warning: openssl_seal(): Binary string expected, Unicode string received in %s on line %d
+
 Warning: openssl_seal(): not a public key (1th member of pubkeys) in %s on line %d
 
index 905e77e48a95fd5853160c913e43325fbd9bb2be..6a712827bcf591f032a57873bb07a9752dfeede1 100644 (file)
@@ -4,12 +4,12 @@ openssl_pkcs7_encrypt() tests
 <?php if (!extension_loaded("openssl")) print "skip"; ?>
 --FILE--
 <?php
-$infile = (binary) (dirname(__FILE__) . "/cert.crt");
-$outfile = (binary) tempnam(b"/tmp", b"ssl");
+$infile = dirname(__FILE__) . "/cert.crt";
+$outfile = tempnam(b"/tmp", b"ssl");
 if ($outfile === false)
        die("failed to get a temporary filename!");
 
-$single_cert = (binary) ("file://" . dirname(__FILE__) . "/cert.crt");
+$single_cert = "file://" . dirname(__FILE__) . "/cert.crt";
 $multi_certs = array($single_cert, $single_cert);
 $assoc_headers = array("To" => "test@test", "Subject" => "testing openssl_pkcs7_encrypt()");
 $assoc_headers_bin = array(b"To" => b"test@test", b"Subject" => b"testing openssl_pkcs7_encrypt()");
@@ -48,6 +48,10 @@ bool(true)
 bool(true)
 bool(true)
 bool(true)
+
+Warning: openssl_pkcs7_encrypt(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Skipping it. in %s on line %d
+
+Warning: openssl_pkcs7_encrypt(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Skipping it. in %s on line %d
 bool(true)
 
 Warning: openssl_pkcs7_encrypt() expects parameter 4 to be array, Unicode string given in %s on line %d
@@ -55,6 +59,8 @@ bool(false)
 bool(false)
 bool(false)
 bool(false)
+
+Warning: openssl_pkcs7_encrypt(): Binary string expected, Unicode string received in %s on line %d
 bool(false)
 bool(false)
 bool(false)
index b0d655b404a4645861b9341e84c6db8765ca4ee3..b2e2715233bd8376611cf866cdeaf8fa5ba1ab15 100644 (file)
@@ -4,13 +4,13 @@ openssl_pkcs7_sign() tests
 <?php if (!extension_loaded("openssl")) print "skip"; ?>
 --FILE--
 <?php
-$infile = (binary) (dirname(__FILE__) . "/cert.crt");
-$outfile = (binary) tempnam(b"/tmp", b"ssl");
+$infile = dirname(__FILE__) . "/cert.crt";
+$outfile = tempnam(b"/tmp", b"ssl");
 if ($outfile === false)
        die("failed to get a temporary filename!");
 
-$privkey = (binary) ("file://" . dirname(__FILE__) . "/private.key");
-$single_cert = (binary) ("file://" . dirname(__FILE__) . "/cert.crt");
+$privkey = "file://" . dirname(__FILE__) . "/private.key";
+$single_cert = "file://" . dirname(__FILE__) . "/cert.crt";
 $assoc_headers = array("To" => "test@test", "Subject" => "testing openssl_pkcs7_sign()");
 $assoc_headers_bin = array(b"To" => b"test@test", b"Subject" => b"testing openssl_pkcs7_sign()");
 $headers = array("test@test", "testing openssl_pkcs7_sign()");
@@ -49,6 +49,10 @@ bool(true)
 bool(true)
 bool(true)
 bool(true)
+
+Warning: openssl_pkcs7_sign(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Skipping it. in %s on line %d
+
+Warning: openssl_pkcs7_sign(): Binary or ASCII-Unicode string expected, non-ASCII-Unicode string received. Skipping it. in %s on line %d
 bool(true)
 
 Warning: openssl_pkcs7_sign() expects parameter 5 to be array, Unicode string given in %s on line %d
@@ -63,6 +67,8 @@ bool(false)
 Warning: openssl_pkcs7_sign(): error opening output file %s in %s on line %d
 bool(false)
 
+Warning: openssl_pkcs7_sign(): Binary string expected, Unicode string received in %s on line %d
+
 Warning: openssl_pkcs7_sign(): error getting cert in %s on line %d
 bool(false)
 
@@ -75,6 +81,8 @@ bool(false)
 Warning: openssl_pkcs7_sign() expects parameter 5 to be array, binary string given in %s on line %d
 NULL
 
+Warning: openssl_pkcs7_sign(): Binary string expected, Unicode string received in %s on line %d
+
 Warning: openssl_pkcs7_sign(): error getting private key in %s on line %d
 bool(false)
 
index 2eef8c5bdc6511d0aca7b0a6be2e9bb927a86853..68729e7579860dbfc8d23ec74280030912b78dbb 100644 (file)
@@ -18,7 +18,7 @@ $priv_key_id = openssl_get_privatekey($priv_key);
 
 $pub_key = file_get_contents($file_pub);
 $pub_key_id = openssl_get_publickey($pub_key);
-$data = "some custom data";
+$data = b"some custom data";
 if (!openssl_sign($data, $signature, $priv_key_id, OPENSSL_ALGO_MD5)) {
        echo "openssl_sign failed.";
 }
index a647c5cf51d69c11e0b8b24bb94f4ed6af9b3749..539f0180761da8fba225253172a9acc08128f0e8 100644 (file)
@@ -7,8 +7,8 @@ if (!extension_loaded("openssl")) die("skip");
 --FILE--
 <?php
 $pub_key_id = false; 
-$signature = '';
-$ok = openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
+$signature = b'';
+$ok = openssl_verify(b"foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5);
 
 class test {
        function __toString() {
@@ -18,11 +18,11 @@ class test {
 $t = new test;
 
 
-var_dump(openssl_verify("foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5));
-var_dump(openssl_verify("foo", $t, $pub_key_id, OPENSSL_ALGO_MD5));
-var_dump(openssl_verify("foo", new stdClass, $pub_key_id, OPENSSL_ALGO_MD5));
-var_dump(openssl_verify("foo", new stdClass, array(), OPENSSL_ALGO_MD5));
-var_dump(openssl_verify("foo", array(), array(), OPENSSL_ALGO_MD5));
+var_dump(openssl_verify(b"foo", $signature, $pub_key_id, OPENSSL_ALGO_MD5));
+var_dump(openssl_verify(b"foo", $t, $pub_key_id, OPENSSL_ALGO_MD5));
+var_dump(openssl_verify(b"foo", new stdClass, $pub_key_id, OPENSSL_ALGO_MD5));
+var_dump(openssl_verify(b"foo", new stdClass, array(), OPENSSL_ALGO_MD5));
+var_dump(openssl_verify(b"foo", array(), array(), OPENSSL_ALGO_MD5));
 var_dump(openssl_verify());
 var_dump(openssl_verify(new stdClass, new stdClass, array(), 10000));
 
@@ -39,17 +39,17 @@ Warning: openssl_verify(): supplied key param cannot be coerced into a public ke
 bool(false)
 
 Warning: openssl_verify() expects parameter 2 to be binary string, object given in %s on line %d
-NULL
+bool(false)
 
 Warning: openssl_verify() expects parameter 2 to be binary string, object given in %s on line %d
-NULL
+bool(false)
 
 Warning: openssl_verify() expects parameter 2 to be binary string, array given in %s on line %d
-NULL
+bool(false)
 
 Warning: openssl_verify() expects at least 3 parameters, 0 given in %s on line %d
-NULL
+bool(false)
 
 Warning: openssl_verify() expects parameter 1 to be binary string, object given in %s on line %d
-NULL
+bool(false)
 Done
index a3bb0eb011f163e0b6c187bf5c916bfd36e8b3f4..276f3934c29632e67fc25c83ed70756c6162e498 100644 (file)
@@ -14,7 +14,7 @@ class test {
 }
 $t = new test;
 
-var_dump(openssl_x509_parse("foo"));
+var_dump(openssl_x509_parse(b"foo"));
 var_dump(openssl_x509_parse($t));
 var_dump(openssl_x509_parse(array()));
 var_dump(openssl_x509_parse());