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

From: Date: Wed, 24 Jul 2002 17:50:28 +0000
Subject: Bug #18543 Updated: Array returned from function with pointer at end
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15067@lists.php.net to get a copy of this message
 ID:               18543
 Updated by:       derick@php.net
 Reported By:      mikeboulet@newfangled.com
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: Win2K/Linux RH 7.1
 PHP Version:      4.2.2
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

Use reset() or foreach()


Previous Comments:
------------------------------------------------------------------------

[2002-07-24 13:28:45] mikeboulet@newfangled.com

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 this bug report at http://bugs.php.net/?id=18543&edit=1



Thread (3 messages)

« previous php.bugs (#15067) next »