Bug #15651 Updated: Output is broken
| From: | mfischer@php.net | Date: | Fri, 07 Jun 2002 01:37:19 +0000 |
| Subject: | Bug #15651 Updated: Output is broken | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-9712@lists.php.net to get a copy of this message | ||
ID: 15651
Updated by: mfischer@php.net
Reported By: pilots@farlep.net
-Status: Open
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: Win2K-Server / UNIX
PHP Version: 4.1.1
Previous Comments:
------------------------------------------------------------------------
[2002-06-06 21:35:35] pilots@farlep.net
It seems this bug does not appear in 4.2.1. Checked on Linux/Apache.
------------------------------------------------------------------------
[2002-06-06 20:05:47] sniper@php.net
reclassified. You should also try the latest release 4.2.1
(just in case someone already fixed this)
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
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