# [PATCH] Fix for 32 bits limit on file size (see bug 48886)

- Thread: https://externals.io/message/46490
- Original archive: https://news-web.php.net/php.internals/46490
- Started by X Ryl on 2009-12-22T15:10:15+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #46490 — X Ryl — 2009-12-22T15:10:15+00:00

URL: https://externals.io/message/46490#46490

Hi,

 I'm not a C developer, so I can't really help with the attached patch.
However, I've tried it with PHP 5.3.0 version I have and it does what it
claims, that is, it gives correct behaviour for the following functions:
filesize, fstat, stat when used on file > 4GB on a 32 bits machine.
Currently, php 5.x doesn't give the correct output for this code (on my
32bits server):
echo filesize("path/to/4.3GBfile");  // expecting 4617089843, got 322122547

With the patch applied, the good result is returned.
From the patch author, it improves the tests results.
From what I've understood, the patch switch to php's double type when the
size overflow the 32bits limit of int.
It doesn't seem to break any existing behaviour (I'm using this on my
multiple project since july, and no bad experience so far).

The explaination by the patch author: http://bugs.php.net/bug.php?id=48886

---

## #46496 — mm w — 2009-12-22T20:38:02+00:00

URL: https://externals.io/message/46490#46496 · In reply to: #46490

Thx,

yep a long convertion, not a big deal, we don't work with 4.3GB files
:-D, well minded people try to avoid that


> Hi,
>
>  I'm not a C developer, so I can't really help with the attached patch.
> However, I've tried it with PHP 5.3.0 version I have and it does what it
> claims, that is, it gives correct behaviour for the following functions:
> filesize, fstat, stat when used on file > 4GB on a 32 bits machine.
> Currently, php 5.x doesn't give the correct output for this code (on my
> 32bits server):
> echo filesize("path/to/4.3GBfile");  // expecting 4617089843, got 322122547
>
> With the patch applied, the good result is returned.
> From the patch author, it improves the tests results.
> From what I've understood, the patch switch to php's double type when the
> size overflow the 32bits limit of int.
> It doesn't seem to break any existing behaviour (I'm using this on my
> multiple project since july, and no bad experience so far).
>
> The explaination by the patch author: http://bugs.php.net/bug.php?id=48886

---

## #46497 — Ferenc Kovacs — 2009-12-22T20:51:33+00:00

URL: https://externals.io/message/46490#46497 · In reply to: #46496

it happens if you are working with some video on demand/video
conversion software

Tyrael

> Thx,
>
> yep a long convertion, not a big deal, we don't work with 4.3GB files
> :-D, well minded people try to avoid that
>
> 
> > […]
