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:
@@ -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;
|
||||
|
||||
17
ext/posix/tests/bug75696.phpt
Normal file
17
ext/posix/tests/bug75696.phpt
Normal 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===
|
||||
Reference in New Issue
Block a user