|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71542 disk_total_space does not work with relative paths
Submitted: 2016-02-07 12:54 UTC Modified: 2021-08-16 12:47 UTC
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: tonybogdanov at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Directory function related
PHP Version: 7.3 ZTS OS: *
Private report: No CVE-ID: None
 [2016-02-07 12:54 UTC] tonybogdanov at gmail dot com
When run on Windows (WAMP) with Apache (using PHP alone in a console is fine), the function disk_total_space() throws Warning: disk_total_space(): The system cannot find the path specified. if a relative path is supplied.

Test script:
echo getcwd() . DIRECTORY_SEPARATOR . 'test' . PHP_EOL;
echo realpath('test') . PHP_EOL;

echo disk_total_space(getcwd() . DIRECTORY_SEPARATOR . 'test') . PHP_EOL;
echo disk_total_space(realpath('test')) . PHP_EOL;
echo disk_total_space('test') . PHP_EOL; // fails


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-31 13:57 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-03-31 13:57 UTC]
Does that still happen to you with any of the actively supported
PHP versions[1]?

[1] <>
 [2020-04-01 08:22 UTC] tonybogdanov at gmail dot com
I can't test this as I don't use Windows anymore, but it's been 4 years, I don't think anybody really cares anymore.
 [2020-04-01 11:27 UTC]
-Status: Feedback +Status: Verified -Package: Apache2 related +Package: Directory function related -Assigned To: cmb +Assigned To:
 [2020-04-01 11:27 UTC]
Thanks for the feedback. :)

I had a closer look, and this issue is not Windows specific, but
rather related to thread-safe (ZTS) builds on any OS.  The problem
is that disk_total_space() and disk_free_space() ignore the VCWD.
 [2020-04-01 11:28 UTC]
-Operating System: Windows 10 x64 +Operating System: * -PHP Version: 5.6.18 +PHP Version: 7.3 ZTS
 [2021-08-16 12:47 UTC]
-Assigned To: +Assigned To: cmb
 [2021-08-16 12:47 UTC]
The following pull request has been associated:

Patch Name: Fix #71542: disk_total_space does not work with relative paths
On GitHub:
 [2021-08-17 09:33 UTC]
Automatic comment on behalf of cmb69
Log: Fix #71542: disk_total_space does not work with relative paths
 [2021-08-17 09:33 UTC]
-Status: Verified +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 09:01:27 2024 UTC