php.net |  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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
15 - 11 = ?
Subscribe to this entry?

 
 [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 :)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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] sander@php.net
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 http://www.php.net/downloads.php

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-2019 The PHP Group
All rights reserved.
Last updated: Fri Dec 13 06:01:25 2019 UTC