Commit a80fffa00d3 for php.net
commit a80fffa00d386ce023f684f81dc448bf27ef1658
Merge: 41c0ffd98bc be55be0a4db
Author: Ilia Alshanetsky <ilia@ilia.ws>
Date: Wed Jun 24 12:57:58 2026 -0400
Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
Fix posix_getgrnam()/posix_getgrgid() crash on NULL group name
diff --cc ext/posix/posix.c
index fcacb25ae32,b659207f67b..e4c2b91678e
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@@ -685,12 -661,19 +685,16 @@@ static void php_posix_group_to_array(st
zval array_members;
int count;
- if (NULL == g)
- return 0;
-
- if (array_group == NULL || Z_TYPE_P(array_group) != IS_ARRAY)
- return 0;
+ ZEND_ASSERT(Z_TYPE_P(array_group) == IS_ARRAY);
array_init(&array_members);
+ zend_hash_real_init_packed(Z_ARRVAL(array_members));
- add_assoc_string(array_group, "name", g->gr_name);
+ if (g->gr_name) {
+ add_assoc_string(array_group, "name", g->gr_name);
+ } else {
+ add_assoc_null(array_group, "name");
+ }
if (g->gr_passwd) {
add_assoc_string(array_group, "passwd", g->gr_passwd);
} else {