diff --git a/ext/posix/posix.c b/ext/posix/posix.c index 8578056b28da..655c522a89af 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -669,7 +669,11 @@ int php_posix_group_to_array(struct group *g, zval *array_group) /* {{{ */ array_init(&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 {