1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 21:41:22 +02:00

Merge branch 'PHP-7.3'

* PHP-7.3:
  Fix #75696: posix_getgrnam fails to print details of group
This commit is contained in:
Christoph M. Becker
2018-09-01 14:30:38 +02:00
2 changed files with 23 additions and 0 deletions

View File

@@ -1081,9 +1081,15 @@ PHP_FUNCTION(posix_getgrnam)
RETURN_FALSE;
}
buf = emalloc(buflen);
try_again:
g = &gbuf;
if (getgrnam_r(name, g, buf, buflen, &g) || g == NULL) {
if (errno == ERANGE) {
buflen *= 2;
buf = erealloc(buf, buflen);
goto try_again;
}
POSIX_G(last_error) = errno;
efree(buf);
RETURN_FALSE;

View File

@@ -0,0 +1,17 @@
--TEST--
Bug #75696 (posix_getgrnam fails to print details of group)
--SKIPIF--
<?php
if (!extension_loaded('posix')) die('skip posix extension not available');
?>
--FILE--
<?php
$gid = posix_getgid();
$name = posix_getgrgid($gid)['name'];
$info = posix_getgrnam($name);
var_dump(is_array($info));
?>
===DONE===
--EXPECT--
bool(true)
===DONE===