php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3006 str_repeat messing with the output buffer?
Submitted: 1999-12-19 14:53 UTC Modified: 2000-06-09 03:39 UTC
From: leon at leonatkinson dot com Assigned:
Status: Closed Package: Misbehaving function
PHP Version: 4.0 Beta 3 OS: Windows
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 leonatkinson dot com
New email:
PHP Version: OS:

 

 [1999-12-19 14:53 UTC] leon at leonatkinson dot com
This code:
<HTML>
<HEAD>
<TITLE>str_repeat</TITLE>
</HEAD>
<BODY>
<?
	print(str_repeat("PHP!<BR>\n", 10));
?>
</BODY>
</HTML>

produces this:
<HTML>
<HEAD>
<TITLE>str_repeat</TITLE>
</HEAD>
<BODY>
PHP!<BR>
PHP!<BR>
PHP!<BR>
PHP!<BR>
PHP!<BR>
PHP!<BR>
PHP!<BR>
PHP!<BR>
PHP!<BR>
PHP!<BR>
 </BODY>
</HTML>

Note the extra space just before the closing body tag.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-12-20 11:58 UTC] andrei at cvs dot php dot net
I have not been able to reproduce this with the latest CVS. Could
you try it with the latest version and see if it happens?

 [2000-06-09 03:39 UTC] zeev at cvs dot php dot net
No response for quite a while...
If the problem persists with 4.0.0, please submit a new bug report.
 [2002-02-20 06:59 UTC] helbockNOSPAM at secession dot com
echo strlen(str_repeat("a",3));

will output "4" on php4.0 beta 3, which proves that str_repeat deliberately adds one character to the end of the string. 

when tested with a later version (php 4.0.5) this error did not occur anymore.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Nov 28 09:00:01 2025 UTC