php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #13003 array-pointer set in a closs-contruktor becomes reset
Submitted: 2001-08-28 10:09 UTC Modified: 2001-08-30 09:08 UTC
From: holler at ergo-soft dot com Assigned:
Status: Closed Package: Arrays related
PHP Version: 4.0.6 OS: Win 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: holler at ergo-soft dot com
New email:
PHP Version: OS:

 

 [2001-08-28 10:09 UTC] holler at ergo-soft dot 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

?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-30 09:08 UTC] dbeu@php.net
unable to reproduce under 4.0.7-dev.
try http://www.php4win.com/~daniel/php-4.0.7rc1-win32.zip
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 15:01:31 2025 UTC