php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #858 sprintf gives "Document Contains No Data" when referenced string is empty
Submitted: 1998-10-19 18:48 UTC Modified: 1998-11-20 11:57 UTC
From: leon at clearink dot com Assigned: ssb (profile)
Status: Closed Package: Misbehaving function
PHP Version: 3.0.5 OS: Solaris
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: leon at clearink dot com
New email:
PHP Version: OS:

 

 [1998-10-19 18:48 UTC] leon at clearink dot com
<?
   print(sprintf("%s", ""));
?>

I should note that this is intermittent, though hitting reload a bunch of times seems to cause it to happen reliably.

---

The above code fragment embedded in any script will cause the described behavior.  For example:

<?
   print("XXX\n");
   print(sprintf("%s", ""));
   print("XXX\n");
?>

Sorry I didn't make the clear at first. 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-11-20 11:57 UTC] zeev
1998-11-14 15:45+0100, ssb:

I am unable to reproduce this, but could you try checking
out the latest version of functions/formatted_print.c and
see if the problem persists?

---

First, it should be noted that this example should in fact
result in 'document contains no data' - it prints nothing!

If you can reliably reproduce a crash (i.e., run httpd -X,
hit a page that contains a printf() of an empty string
several times, and get that process to crash - please update
the bug report or submit a new one.  Note that after n times
of hitting the standalone httpd, it'll properly exit (n is
usually 30).
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 05:01:33 2025 UTC