Skip to content

Commit a2d7bd6

Browse files
committed
Merge branch 'PHP-8.4' into PHP-8.5
2 parents 4bb88e0 + 17f94f0 commit a2d7bd6

2 files changed

Lines changed: 22 additions & 5 deletions

File tree

‎ext/hash/hash_xxhash.c‎

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,13 @@ PHP_HASH_API void PHP_XXH64Init(PHP_XXH64_CTX *ctx, HashTable *args)
115115
zval *seed = zend_hash_str_find_deref(args, "seed", sizeof("seed") - 1);
116116
/* This might be a bit too restrictive, but thinking that a seed might be set
117117
once and for all, it should be done a clean way. */
118-
if (seed && IS_LONG == Z_TYPE_P(seed)) {
119-
XXH64_reset(&ctx->s, (XXH64_hash_t)Z_LVAL_P(seed));
120-
return;
121-
} else {
122-
php_error_docref(NULL, E_DEPRECATED, "Passing a seed of a type other than int is deprecated because it is the same as setting the seed to 0");
118+
if (seed) {
119+
if (IS_LONG == Z_TYPE_P(seed)) {
120+
XXH64_reset(&ctx->s, (XXH64_hash_t)Z_LVAL_P(seed));
121+
return;
122+
} else {
123+
php_error_docref(NULL, E_DEPRECATED, "Passing a seed of a type other than int is deprecated because it is the same as setting the seed to 0");
124+
}
123125
}
124126
}
125127

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
Hash: xxHash options without a seed do not emit a deprecation
3+
--FILE--
4+
<?php
5+
6+
foreach (["xxh32", "xxh64", "xxh3", "xxh128"] as $a) {
7+
var_dump(hash($a, "x", options: []) === hash($a, "x"));
8+
}
9+
10+
?>
11+
--EXPECT--
12+
bool(true)
13+
bool(true)
14+
bool(true)
15+
bool(true)

0 commit comments

Comments
 (0)