[PHP-CVS] [php-src] PHP-8.4: Fix GH-22935: Make php_hash.h includable from C++ code (#22940)
[email protected] (Weilin Du via GitHub) Thu, 30 Jul 2026 16:02:54 +0000
| Newsgroups | php.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Weilin Du (LamentXU123)
Committer: GitHub (web-flow)
Pusher: LamentXU123
Date: 2026-07-31T00:02:51+08:00
Commit: https://github.com/php/php-src/commit/a96f6ff2c7a8452b78c1267f9e897ab6e2c5e849
Raw diff: https://github.com/php/php-src/commit/a96f6ff2c7a8452b78c1267f9e897ab6e2c5e849.diff
Fix GH-22935: Make php_hash.h includable from C++ code (#22940)
Changed paths:
M ext/hash/php_hash.h
Diff:
diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h
index b77557c5bf78..bf99ce185b46 100644
--- a/ext/hash/php_hash.h
+++ b/ext/hash/php_hash.h
@@ -158,7 +158,7 @@ static inline void *php_hash_alloc_context(const php_hash_ops *ops) {
/* Zero out context memory so serialization doesn't expose internals */
if (ops->context_align > 0) {
size_t align = ops->context_align;
- char *base = ecalloc(1, ops->context_size + align);
+ char *base = (char *) ecalloc(1, ops->context_size + align);
size_t offset = align - ((uintptr_t)base & (align - 1));
char *ptr = base + offset;
ptr[-1] = (char)offset;