|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2033 serialize() produces: FATAL: emalloc(): Unable to allocate 4160742841l bytes
Submitted: 1999-08-11 14:13 UTC Modified: 2002-06-16 22:43 UTC
From: elfchief at lupine dot org Assigned:
Status: Not a bug Package: Misbehaving function
PHP Version: 3.0.12 OS: SunOS 4.1.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: elfchief at lupine dot org
New email:
PHP Version: OS:


 [1999-08-11 14:13 UTC] elfchief at lupine dot org
Calling serialize() produces an "unable to allocate insane amounts of memory" error... Even <? serialize(5); ?> will produce this error.

This is caused because functions/var.c is using sprintf() rather than _php3_sprintf(), where the latter is designed to work around a 'feature' in SunOS where sprintf returns the string written (char *) rather than the number of characters written (int).

1,$ s/sprintf/_php3_sprintf/g in functions/var.c to repair this problem.

(I also noticed the same problem in interbase.c, though I don't use that module myself. The fix is left as an exercise for the reader :)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1999-08-31 09:20 UTC] thies at cvs dot php dot net
fixed in CVS
 [1999-08-31 09:25 UTC] thies at cvs dot php dot net
unifixed - configure needs to find that out!

 [1999-11-12 12:01 UTC] joey at cvs dot php dot net
If I am not mistaken, thies is trying to say that configure should decide whether to use
sprintf() or _php3_sprintf().  I beleive this is in progress. Should this be "assigned"?
 [2002-06-16 08:37 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately, PHP 3 is no longer supported. Please download
the latest version of PHP 4 from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Sep 25 02:01:23 2020 UTC