|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-03-01 17:59 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 29 12:00:01 2025 UTC |
Description: ------------ When a variable's type is "NULL" (as reported by var_dump()) which happens when the variable is set to 0, it can no longer be used to access the 0th position in an array. In my perticular case, I was attempting this operation: return $this->serverdata[$this->dataindex][$var]; and needed to do this to get it to run correctly: return $this->serverdata[intval($this->dataindex)][$var]; I have not throughly tested this bug for other cases where it occurs, but this is definatly one of the cases. Reproduce code: --------------- class testing { private $dataindex; private $serverdata; function __construct() { $dataindex = 0; $serverdata = array(array("name"=>"Er1c","data"=>"foo"),array("name"=>"Bob","data"=>"bar")); } function __get($var) { return $this->serverdata[$this->dataindex][$var]; } } $blah = new testing(); echo "Name:" . $blah->name; Expected result: ---------------- Name: Er1c Actual result: -------------- Name: