Bug #15651 Updated: Output is broken

From: Date: Fri, 07 Jun 2002 00:05:48 +0000
Subject: Bug #15651 Updated: Output is broken
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-9676@lists.php.net to get a copy of this message
ID: 15651 Updated by: sniper@php.net Reported By: pilots@farlep.net -Status: Open +Status: Feedback -Bug Type: *General Issues +Bug Type: Scripting Engine problem Operating System: Win2K-Server / UNIX PHP Version: 4.1.1 New Comment: reclassified. You should also try the latest release 4.2.1 (just in case someone already fixed this) Previous Comments: ------------------------------------------------------------------------ [2002-02-23 07:27:54] pilots@farlep.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-02-23 06:46:36] pilots@farlep.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-22 06:35:16] 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-21 21:27:48] pilots@farlep.net Sorry. I wanted to say "... My site is complex enough..." ------------------------------------------------------------------------ [2002-02-21 21:25:45] pilots@farlep.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. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/15651 -- Edit this bug report at http://bugs.php.net/?id=15651&edit=1

« previous php.bugs (#9676) next »