getSize() didnt work / always zero #132

Open
opened 2025-01-20 00:50:58 +01:00 by DasFragezeichen · 0 comments
DasFragezeichen commented 2025-01-20 00:50:58 +01:00 (Migrated from github.com)

It seems that the method getSize() didnt work.
I always get the result 0 (zero)

I connect to a Windows Server 2022 with administrators privilege.
getName() is working as expected.

Here is my code I used, but I also tested the example code on the main page. (Same result)

try {
	$serverFactory = new ServerFactory();
	$auth = new BasicAuth($_ENV['LDAP_USERNAME'], '', $_ENV['LDAP_PASSWORD']);
	$server = $serverFactory->createServer($_ENV['LDAP_IP'], $auth);

	$shares = array_map('trim', explode(',', $_ENV['LDAP_SHARES']));

	$folders = [];
	
	foreach ($shares as $shareName) {
		$share = $server->getShare($shareName);

		foreach ($share->dir('/') as $fileInfo) {
			if ($fileInfo->isDirectory()) {
				$folders[] = [
					'name' => $fileInfo->getName(),
					'size' => $fileInfo->getSize(),
				];
			}
		}
	}

	return $folders;

} catch (LdapException $e) {
	$this->logger->error('LDAP Error: ' . $e->getMessage());
	throw $e;
}
It seems that the method getSize() didnt work. I always get the result 0 (zero) I connect to a Windows Server 2022 with administrators privilege. getName() is working as expected. Here is my code I used, **but I also tested the example code on the main page. (Same result)** ``` try { $serverFactory = new ServerFactory(); $auth = new BasicAuth($_ENV['LDAP_USERNAME'], '', $_ENV['LDAP_PASSWORD']); $server = $serverFactory->createServer($_ENV['LDAP_IP'], $auth); $shares = array_map('trim', explode(',', $_ENV['LDAP_SHARES'])); $folders = []; foreach ($shares as $shareName) { $share = $server->getShare($shareName); foreach ($share->dir('/') as $fileInfo) { if ($fileInfo->isDirectory()) { $folders[] = [ 'name' => $fileInfo->getName(), 'size' => $fileInfo->getSize(), ]; } } } return $folders; } catch (LdapException $e) { $this->logger->error('LDAP Error: ' . $e->getMessage()); throw $e; } ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
icewind/SMB#132
No description provided.