|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesphp-7.3-fix-posix-fns-with-zts.patch (last revision 2020-05-06 06:53 UTC by zboszor at pr dot hu)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-05-06 07:10 UTC] cmb@php.net
-Status: Open
+Status: Verified
[2020-05-06 07:10 UTC] cmb@php.net
[2020-06-17 17:59 UTC] alexdowad@php.net
[2020-06-19 15:33 UTC] nikic@php.net
[2020-06-19 15:33 UTC] nikic@php.net
-Status: Verified
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 08:00:01 2025 UTC |
Description: ------------ ZTS build of PHP uses getgrnam_r, getgrgid_r, getpwnam_r and getpwuid_r behind their respective posix_* functions. These functions may return ERANGE if the buffer supplied by the caller is too small. sysconf() returns 1024 for _SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SIZE_MAX. Only posix_getgrnam calling getgrnam_r handles ERANGE properly by retrying with a larger buffer. This was noticed on a system with a group containing many users, so the respective line in /etc/group exceeded 2KB. Test script: --------------- <?php $i = 200; /* a GID that has a very long line in /etc/group */ $data = posix_getgrgid($i); $error_num = posix_get_last_error(); if ($error_num > 0) { echo "\nERROR NUM = $error_num\n"; echo "ERROR MES = " . posix_strerror($error_num) . "\n\n"; } else { printf("%s\n", $data["name"]); } ?> Expected result: ---------------- The group name should be printed. Actual result: -------------- Error number 34 (ERANGE) is printed.