Bug #18543: Array returned from function with pointer at end

From: Date: Wed, 24 Jul 2002 17:28:46 +0000
Subject: Bug #18543: Array returned from function with pointer at end
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15062@lists.php.net to get a copy of this message
From:             mikeboulet@newfangled.com
Operating system: Win2K/Linux RH 7.1
PHP version:      4.2.2
PHP Bug Type:     Arrays related
Bug description:  Array returned from function with pointer at end

It is expected that the $msgs array passed back out of the test() function
call would have a pointer pointing to the first item. I confirmed that
this works correctly under PHP 4.0.6. 

It doesn't work under 4.2.1 either.

Notice the output of the print_r()

// TEST SCRIPT

$newmsgs = test();
print_r( current( $newmsgs ));
function test()
{
	$msgs[][a] = 10;
	$msgs[][b] = 20;
	$msgs[][c] = 30;
	$msgs[][d] = 40;
	$msgs[][e] = 50;

	while( list( $idx, $msg ) = each( $msgs ) )
	{
		
	}

	return $msgs;
}


-- 
Edit bug report at http://bugs.php.net/?id=18543&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=18543&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=18543&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=18543&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=18543&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18543&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=18543&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=18543&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=18543&r=submittedtwice
register_globals:    http://bugs.php.net/fix.php?id=18543&r=globals



Thread (3 messages)

« previous php.bugs (#15062) next »