php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3938 reset(nonvariable) causes execution failure
Submitted: 2000-03-27 17:12 UTC Modified: 2000-06-13 05:59 UTC
From: jeremiah at emphasys dot net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0 Beta 4 Patch Level 1 OS: Redhat 6.1
Private report: No CVE-ID: None
 [2000-03-27 17:12 UTC] jeremiah at emphasys dot net
<?php
$test = array('one','two','three');
reset(test);
/*
** The above reset() causes script execution to fail, no output from script.
** This was hard to find when buried in large script with no output to debug.
** Produces the following warning in PHP3
** Warning: Cannot pass expression as argument 1 by reference
*/
while(list($key,$value) = each($test)) {
	echo "$key => $value<br>\n";
}
?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-20 04:38 UTC] hholzgra at cvs dot php dot net
reset(test) won't work, try reset($test) instead
 [2000-05-20 07:41 UTC] hholzgra at cvs dot php dot net
uh,oh, if only i could read 
didn't get the meta-question here

so i'll re-open it for now
 [2000-06-13 05:59 UTC] andrei at cvs dot php dot net
reset() doesn't crash in the release version - it simply outputs an error message.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 24 12:01:31 2024 UTC