]> granicus.if.org Git - php/commitdiff
MFH crypt() tests
authorJoey Smith <joey@php.net>
Sat, 20 Feb 2010 19:13:09 +0000 (19:13 +0000)
committerJoey Smith <joey@php.net>
Sat, 20 Feb 2010 19:13:09 +0000 (19:13 +0000)
ext/standard/tests/strings/bug51059.phpt [new file with mode: 0644]
ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt [new file with mode: 0644]

diff --git a/ext/standard/tests/strings/bug51059.phpt b/ext/standard/tests/strings/bug51059.phpt
new file mode 100644 (file)
index 0000000..561fc79
--- /dev/null
@@ -0,0 +1,13 @@
+--TEST--
+Bug #51059 crypt() segfaults on certain salts
+--XFAIL--
+Needs a patch from Pierre
+--FILE--
+<?php
+
+if (crypt('a', '_') === FALSE) echo 'OK';
+else echo 'Not OK';
+
+?>
+--EXPECT--
+OK
diff --git a/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt b/ext/standard/tests/strings/crypt_blowfish_invalid_rounds.phpt
new file mode 100644 (file)
index 0000000..03c6c83
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+Test Blowfish crypt() with invalid rounds
+--XFAIL--
+Needs a patch from Pierre
+--FILE--
+<?php
+
+foreach(range(32, 38) as $i) {
+  if (crypt('U*U', '$2a$'.$i.'$CCCCCCCCCCCCCCCCCCCCCC$') === FALSE) {
+    echo "$i. OK\n";
+  } else {
+    echo "$i. Not OK\n";
+  }
+}
+
+?>
+--EXPECT--
+32. OK
+33. OK
+34. OK
+35. OK
+36. OK
+37. OK
+38. OK