php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15651 Output is broken
Submitted: 2002-02-20 18:14 UTC Modified: 2002-06-06 21:37 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: pilots at farlep dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.1.1 OS: Win2K-Server / UNIX
Private report: No CVE-ID: None
 [2002-02-20 18:14 UTC] pilots at farlep dot net
My site was developed on php4.0.6 on Win2K-Server (home PC) and runned on UNIX (commercial hosting). All things were OK anywhere, on both IIS (CGI and ISAPI) and Apache (CGI and module).
Then my hoster setuped php4.1.1. and site stopped to work! And the same problem was on another hoster which used 4.1.1 version (both are running Unix).
I tryed to setup 4.1.1 on my PC and got the same problem. It does not depend on OS, Web-server or mode (cgi, ISAPI, module...), it appears anywhere. I myself checked all settings in php.ini, but all settings was OK there.

The problem looks so: browser gets only part of pages, pages are cutted in some places, which are individual for each page (although pages have common header) and for each OS or server. And there is no visible dependency on html or php-code in those places.
So, it looks as some unexpected output crash...

Unfortunately, I don't know how I can describe the problem better... If you need more info, please, ask concrete questions.

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-02-21 03:17 UTC] yohgaki@php.net
It sounds like you have kwon issue for 4.1..x.

Do you use ob_end_*() functions? Any where in your script?
What is your 

output_buffering
and 
zlib.output_compression

ini settings?

 [2002-02-21 03:55 UTC] yohgaki@php.net
I forgot about ob_implicit_flush ;)
Do you use it?
 [2002-02-21 05:49 UTC] pilots at farlep dot net
I use default settings:

output_buffering = Off
zlib.output_compression = Off

and don't use any output buffering functions
 [2002-02-21 06:04 UTC] yohgaki@php.net
Then you are having crash bug(s).
First grab snapshot http://snaps.php.net and check if you still have the problem. (Make sure you build with --enable-debug)

If you still have problems, check your httpd error logs. If you see segfaults, send a backtrace. 
 [2002-02-21 18:37 UTC] pilots at farlep dot net
Unfortunately, my home OS is Win2K-Server, and I myself don't have VC++ to try to build PHP from sources...
Can I provide any useful information for you, using my OS software which I already have?
I have both IIS and Apache web servers.
 [2002-02-21 20:26 UTC] yohgaki@php.net
If you can create _short_ & _complete_ script that reproduces the problem. We can fix it :)
 [2002-02-21 21:25 UTC] pilots at farlep dot net
I tryed to make some small scripts before, but there were no problems with them. My site is complete enough, there is a lot of includes (but execution time for homepage on my PC is less than 1 sec.). It looks like there are no problems for simply scripts, but I'll try again to make something ...
By that time, if you like you may watch the results on different servers:
1) php4.0.6: http://www.sec4.wfdns.com/www.freetakeout.com/
2) php4.1.1: http://vh110014.radntech.ca/fto/ 
- you may try to click some links there ("log-in to your account", for example) to see the difference in cutting point.
 [2002-02-21 21:27 UTC] pilots at farlep dot net
Sorry. I wanted to say "... My site is complex enough..."
 [2002-02-22 06:35 UTC] yohgaki@php.net
Could you set up linux/freebsd box to reproduce this bug? 
And generate backtrace. (Or get exit code with gdb)

You can write "error_log(__FILE__.'(.'__LINE__.')')"
to locate to find ofending function/line also.


 [2002-02-23 06:46 UTC] pilots at farlep dot net
I made test using the advised method, and found that crush appears in one my simple function "call". A simple example goes below:

<?
// --------------------------------------\
// Apply specified function to arguments
//   if 2'nd argument is an array, its elements replace arguments
//   it's a way to apply function to arguments by their references
// Examples:
//   list($c1)=call("intval",$a1);
//   list($c2,$c3)=call("htmlspecialchars",$b2,$b3);
//   call("htmlspecialchars",array(&$b2,&$b3));
// ------------------------------------\
function call() {
  if (func_num_args()<2) return false;
  $argv=func_get_args();
  $func=array_shift($argv);
error_log(__FILE__.'('.__LINE__.')');			//
  if (is_array($argv[0])) $argv=&$argv[0];		// Crush is here
error_log(__FILE__.'('.__LINE__.')');			//
  reset($argv);
  while (list($k,$v)=each($argv)) $argv[$k]=$func($v);
  reset($argv);
  return $argv;
  }
// ------------------------------------/


call("intval",1);		// OK
call("intval",array(1));	// Crush
?>

Note: actually cutting line goes some earlier than that crush point, but, I think it's because some PHP bufferization, and is not important now.
 [2002-02-23 07:27 UTC] pilots at farlep dot net
I've found a decision of problem: I simply need replase line
if (is_array($argv[0])) $argv=&$argv[0];
to:
if (is_array($argv[0])) $argv=$argv[0];
And I'll not lose any fuctionality features.

So, crush appears when an array element assigns to the same array by reference. Althow this operation is not very often and very useful :-), it works correctly and w/o crush in 4.0.6 version, and I think this crush should be fixed though.
 [2002-06-06 20:05 UTC] sniper@php.net
reclassified. You should also try the latest release 4.2.1
(just in case someone already fixed this)


 [2002-06-06 21:35 UTC] pilots at farlep dot net
It seems this bug does not appear in 4.2.1. Checked on Linux/Apache.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Aug 20 11:01:28 2024 UTC