(string $rootReal, string $candidateReal)
| 649 | } |
| 650 | |
| 651 | private static function isPathInsideOrSame(string $rootReal, string $candidateReal): bool |
| 652 | { |
| 653 | $root = rtrim($rootReal, DIRECTORY_SEPARATOR); |
| 654 | $candidate = rtrim($candidateReal, DIRECTORY_SEPARATOR); |
| 655 | if ($root === '' && $rootReal === DIRECTORY_SEPARATOR) { |
| 656 | $root = DIRECTORY_SEPARATOR; |
| 657 | } |
| 658 | if ($candidate === '' && $candidateReal === DIRECTORY_SEPARATOR) { |
| 659 | $candidate = DIRECTORY_SEPARATOR; |
| 660 | } |
| 661 | if ($root === '' || $candidate === '') { |
| 662 | return false; |
| 663 | } |
| 664 | $rootPrefix = $root === DIRECTORY_SEPARATOR ? DIRECTORY_SEPARATOR : $root . DIRECTORY_SEPARATOR; |
| 665 | return $candidate === $root || str_starts_with($candidate . DIRECTORY_SEPARATOR, $rootPrefix); |
| 666 | } |
| 667 | |
| 668 | public static function listChildren(string $folder, string $user, array $perms, ?string $cursor = null, int $limit = 500, bool $probe = true): array |
| 669 | { |
no outgoing calls
no test coverage detected