Skip to content

Commit fd3fc5c

Browse files
committed
Fix GH-7826: Inconsistent argument name in hash_hmac_file and hash_file
Like `hash_file()`, `hash_hmac_file()` expects a filename, and not some string data. Fixing this now, constitutes a (hopefully small) BC break though. Closes GH-7828.
1 parent b4ba65d commit fd3fc5c

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ PHP NEWS
1313
- Hash:
1414
. Fixed bug GH-7759 (Incorrect return types for hash() and hash_hmac()).
1515
(cmb)
16+
. Fixed bug GH-7826 (Inconsistent argument name in hash_hmac_file and
17+
hash_file). (cmb)
1618

1719
- OCI8:
1820
. Fixed bug GH-7765 (php_oci_cleanup_global_handles segfaults at second

ext/hash/hash.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ function hash_file(string $algo, string $filename, bool $binary = false): string
88

99
function hash_hmac(string $algo, string $data, string $key, bool $binary = false): string {}
1010

11-
function hash_hmac_file(string $algo, string $data, string $key, bool $binary = false): string|false {}
11+
function hash_hmac_file(string $algo, string $filename, string $key, bool $binary = false): string|false {}
1212

1313
function hash_init(string $algo, int $flags = 0, string $key = ""): HashContext {}
1414

ext/hash/hash_arginfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: f73c6fa1a4ac1ca93f87775bbe69fbdb2deb5746 */
2+
* Stub hash: ae4f5ceba77eee7062cbd2fadb112aac33d198ce */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_hash, 0, 2, IS_STRING, 0)
55
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
@@ -22,7 +22,7 @@ ZEND_END_ARG_INFO()
2222

2323
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_hash_hmac_file, 0, 3, MAY_BE_STRING|MAY_BE_FALSE)
2424
ZEND_ARG_TYPE_INFO(0, algo, IS_STRING, 0)
25-
ZEND_ARG_TYPE_INFO(0, data, IS_STRING, 0)
25+
ZEND_ARG_TYPE_INFO(0, filename, IS_STRING, 0)
2626
ZEND_ARG_TYPE_INFO(0, key, IS_STRING, 0)
2727
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, binary, _IS_BOOL, 0, "false")
2828
ZEND_END_ARG_INFO()

ext/hash/tests/hash_hmac_file_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algo
4343
hash_hmac_file(): Argument #1 ($algo) must be a valid cryptographic hashing algorithm
4444

4545
-- Testing hash_hmac_file() function with bad path --
46-
hash_hmac_file(): Argument #2 ($data) must not contain any null bytes
46+
hash_hmac_file(): Argument #2 ($filename) must not contain any null bytes

0 commit comments

Comments
 (0)