Bug #13003 Updated: array-pointer set in a closs-contruktor becomes reset

From: Date: Thu, 30 Aug 2001 13:08:17 +0000
Subject: Bug #13003 Updated: array-pointer set in a closs-contruktor becomes reset
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-64707@lists.php.net to get a copy of this message
ID: 13003
Updated by: dbeu
Reported By: holler@ergo-soft.com
Old Status: Open
Status: Closed
Bug Type: Arrays related
Operating System: Win 2000
PHP Version: 4.0.6
New Comment:

unable to reproduce under 4.0.7-dev.
try http://www.php4win.com/~daniel/php-4.0.7rc1-win32.zip

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

[2001-08-28 10:09:18] holler@ergo-soft.com

<?php

/*
 * seams to be a bug
 *
 * array-position set in the constructor moves back to 1 ??!!
 */

class bug {
	var $arr;
	function bug() {
		$this->arr = array(1,2,3,4,5);
		reset($this->arr);
		next($this->arr);
		next($this->arr); // set to 3. element
		echo "current() set to " . current($this->arr) . " in
constructor<br>";
	}
	function show() {
		echo current($this->arr) . "<br>";;
	}
}

$o = new bug();
echo "current() should still be 3 but is " . current($o->arr) . "<br>";
// back on 1. element ??!!
$o->show(); // the same

?>


------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=13003&edit=1



Thread (2 messages)

« previous php.dev (#64707) next »