Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the function posix_getpwuid return leads to the main page not show entirely. #1268

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

imcraftsman
Copy link

running envirement: Android 4.4+PHP 7.4.3+ KSWEB
http://192.168.1.2/tinyfilemanager.php, afer login,the main page could not be showed entirely,it just shows half of navigation bar.

that's becuase of
there are two same lines of codes which cause the problem. they are $owner = posix_getpwuid(fileowner($path . '/' . $f)); when the funciton fileowner($path . '/' . $f) return 0 and run the function posix_getpwuid(....) at next step, it trig an error. please check the codes in line 2156--2168 and 2221--2233.

suggest replace these two parts with followed codes:
$owner = array('name' => '?');
$group = array('name' => '?');
if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
try{
$owner_id = fileowner($path . '/' . $f);
if($owner_id != 0) {
$owner_info = posix_getpwuid($owner_id);
if ($owner_info) {
$owner = $owner_info;
}
}

                    $group_id = filegroup($path . '/' . $f);
                    $group_info = posix_getgrgid($group_id);
                    if ($group_info) {
                         $group =  $group_info;
                     }

                } catch(Exception $e){
                   error_log("exception:" . $e->getMessage());
                }
            }

running envirement: Android 4.4+PHP 7.4.3+ KSWEB
http://192.168.1.2/tinyfilemanager.php, afer login,the main page could not be showed entirely,it just shows half of navigation bar.

that's becuase of
there are two same lines of codes which cause the problem. they are
$owner = posix_getpwuid(fileowner($path . '/' . $f));
when the funciton fileowner($path . '/' . $f)  return 0 and  run the function posix_getpwuid(....), it trig an error.
please check the codes in line 2156--2168 and 2221--2233

suggest replace these two parts with followed  codes:
                $owner = array('name' => '?');
                $group = array('name' => '?');
                if (function_exists('posix_getpwuid') && function_exists('posix_getgrgid')) {
                    try{
                        $owner_id = fileowner($path . '/' . $f);
                        if($owner_id != 0) {
                            $owner_info = posix_getpwuid($owner_id);
                           if ($owner_info) {
                                  $owner =  $owner_info;
                           }
                       }

                        $group_id = filegroup($path . '/' . $f);
                        $group_info = posix_getgrgid($group_id);
                        if ($group_info) {
                             $group =  $group_info;
                         }

                    } catch(Exception $e){
                       error_log("exception:" . $e->getMessage());
                    }
                }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant