com php-src: Fix a few tests and remove error/warning for *0: ext/standard/crypt.c ext/standard/tests/strings/crypt_blowfis h_variation2.phpt
| From: | Stanislav Malyshev | Date: | Tue, 13 Jan 2015 16:49:09 +0000 |
| Subject: | com php-src: Fix a few tests and remove error/warning for *0: ext/standard/crypt.c ext/standard/tests/strings/crypt_blowfis h_variation2.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-84506@lists.php.net to get a copy of this message | ||
Commit: 4a2fe3d0abd7b566b7865c387e1173093f70d626
Author: Anthony Ferrara <ircmaxell@gmail.com> Tue, 13 Jan 2015 11:49:09 -0500
Parents: 9cc988722451a011b5996103d07424890a2ee6c9
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=4a2fe3d0abd7b566b7865c387e1173093f70d626
Log:
Fix a few tests and remove error/warning for *0
Changed paths:
M ext/standard/crypt.c
M ext/standard/tests/strings/crypt_blowfish_variation2.phpt
Diff:
diff --git a/ext/standard/crypt.c b/ext/standard/crypt.c
index dee74ce..712b2ab 100644
--- a/ext/standard/crypt.c
+++ b/ext/standard/crypt.c
@@ -216,6 +216,8 @@ PHPAPI zend_string *php_crypt(const char *password, const int pass_len, const ch
ZEND_SECURE_ZERO(output, PHP_MAX_SALT_LEN + 1);
return result;
}
+ } else if (salt[0] == '*' && (salt[1] == '0' || salt[1] ==
'1')) {
+ return NULL;
} else {
/* DES Fallback */
diff --git a/ext/standard/tests/strings/crypt_blowfish_variation2.phpt
b/ext/standard/tests/strings/crypt_blowfish_variation2.phpt
index 21bedc1..9db9e21 100644
--- a/ext/standard/tests/strings/crypt_blowfish_variation2.phpt
+++ b/ext/standard/tests/strings/crypt_blowfish_variation2.phpt
@@ -1,10 +1,10 @@
--TEST--
-Test Blowfish crypt() falls back to DES when rounds are not specified,
+Test Blowfish crypt() does not fall back to DES when rounds are not specified,
or Blowfish is not available.
--FILE--
<?php
$crypt = crypt(b'U*U',
b'$2a$CCCCCCCCCCCCCCCCCCCCC.E5YPO9kmyuRGyh0XouQYb4YMJKvyOeW');
-if ($crypt===b'$2SHYF.wPGyfE') {
+if ($crypt==='*0') {
echo "OK\n";
} else {
echo "Not OK\n";