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

is_file (and fopen) fails with files > 2GB #3

Closed
vhalasu opened this issue Mar 18, 2013 · 5 comments
Closed

is_file (and fopen) fails with files > 2GB #3

vhalasu opened this issue Mar 18, 2013 · 5 comments

Comments

@vhalasu
Copy link

vhalasu commented Mar 18, 2013

This affects path validation in constructor. For files with size over PHP_INT_MAX is_file returns FALSE. Functions is_link, is_dir, is_readable, file_exists are not affected. I tried following:

if (file_exists($path) && (is_file($path) || !is_file($path) && !is_dir($path)))
    $this->path = $path;

For files under 2GB works file_exists && is_file as before, and for bigger ones file_exists && !is_file && !is_dir. I'm not sure if this is optimal, I just hope there are no file types that would return FALSE for both is_file and is_dir. :-)

Env.: PHP 5.3.5, 64bit machine with 32bit Suse linux 11.4
Tried with 670MB, 2.6GB, 4.6GB and 6.8GB files and symlinks to them.

@jkuchar
Copy link
Owner

jkuchar commented Mar 18, 2013

I tested everything on Windows Server. It is not affected. I have Linux Mint x64 on virtual I'll try it there.

@vhalasu
Copy link
Author

vhalasu commented Mar 18, 2013

Method sizeNativeRead actually worked on FAT32 partition with that 2.6GB file, no warning for fopen. (Sorry, forgot to tell you.)

@jkuchar
Copy link
Owner

jkuchar commented Mar 18, 2013

Using NTFS on Windows Server.

jkuchar pushed a commit that referenced this issue Oct 21, 2013
…an 2GB (better but not ideal solution; related to #3)
@jkuchar
Copy link
Owner

jkuchar commented Oct 21, 2013

Not sure if it resolves your problem, is it better? df9e05e

@jkuchar jkuchar closed this as completed Dec 31, 2015
@jkuchar
Copy link
Owner

jkuchar commented Dec 31, 2015

Closed due to innactivity. Reopen anytime if it is still relevant.

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

No branches or pull requests

2 participants