Jump to content

Flush is removing part of string?


ZachMEdwards

Recommended Posts

Hey guys! I found a flush function and it seems to be working well, but sometimes it will cut off characters. It's very strange.

 

Here's my flush function:

	function out($str) {
	echo $str."<br />\n";
	vbflush();
}

function vbflush() {
	if (ob_get_length()){           
		@ob_flush();
		@flush();
		@ob_end_flush();
	}   
	@ob_start();
}

And I'm calling it like this:

out('Waiting 30 seconds until execution');

And this is my output:

Waiting 30 seconds until executio

Anyone know why?

Link to comment
https://forums.phpfreaks.com/topic/211673-flush-is-removing-part-of-string/
Share on other sites

That's very strange indeed.  I've copied that code exactly and saved it to my server, and the output is as expected.

 

See it here..

 

I wonder if it has anything to do with the line feed at the end of the string?  It seems that only the final letter 'n' is cut off, so perhaps there is something with the '\n' that is causing it?  This shouldn't be the case, but I can't see what else would even possibly cause that.  Does it still do it if you remove the line feed?  And what about changing the single quotes to double quotes when you call the out() function?

 

Try changing your parameter to a string that ends in a letter other than n.  Whatever the case, it seems to be exclusive to your server, so you must have a setting somewhere that is causing it.

 

Also, is it cutting off the <br /> tag as well?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.