note 61358 added to function.array

From: Date: Wed, 01 Feb 2006 15:07:55 +0000
Subject: note 61358 added to function.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-102816@lists.php.net to get a copy of this message
Cannot use assign-op operators with overloaded objects nor string offsets After upgrading PHP to the newest version this error occurs every now and then. In my case i got the error in this code: foreach ($serviceCenter as $scname) { $failed[$scname]=0; $passed[$scname]=0; $almostfailed[$scname]=0; } Not always but randomly the above error message appears. For this simple case the fix is to declare the arrays $failed=array(); $passed=array(); $almostfailed=array(); before entering the loop. But it would be difficult for multi dimensional arrays. Also the error message gives a line number somewhere after the loop so it makes it hard to track. ---- Server IP: 64.246.30.37 Probable Submitter: 217.10.50.85 (proxied: 172.29.23.67, 172.23.16.162) ---- Manual Page -- http://www.php.net/manual/en/function.array.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61358 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61358&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61358&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61358&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61358&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61358&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61358&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61358&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61358&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102816) next »