Fixes #2869

Ported https://bugs.php.net/bug.php?id=66021.
why do you have to save this? Can't you just use the `size` that is passed in, below?