note 126766 added to function.posix-geteuid
| From: | divinity76+spam at gmail dot com | Date: | Fri, 14 Jan 2022 22:48:24 +0000 |
| Subject: | note 126766 added to function.posix-geteuid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217494@lists.php.net to get a copy of this message | ||
if you for some reason need the euid without depending on php-posix being available, try
<?php
function geteuid_without_posix_dependency(): int
{
try {
// this is faster if available
return \posix_geteuid();
} catch (\Throwable $ex) {
// php-posix not available.. fallback to hack
$t = tmpfile();
$ret = fstat($t)["uid"];
fclose($t);
return $ret;
}
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 84.48.255.36)
----
Manual Page -- https://php.net/manual/en/function.posix-geteuid.php
Edit -- https://main.php.net/note/edit/126766
Del: integrated -- https://main.php.net/note/delete/126766/integrated
Del: useless -- https://main.php.net/note/delete/126766/useless
Del: bad code -- https://main.php.net/note/delete/126766/bad+code
Del: spam -- https://main.php.net/note/delete/126766/spam
Del: non-english -- https://main.php.net/note/delete/126766/non-english
Del: in docs -- https://main.php.net/note/delete/126766/in+docs
Del: other reasons-- https://main.php.net/note/delete/126766
Reject -- https://main.php.net/note/reject/126766
Search -- https://main.php.net/manage/user-notes.php