ID:               27452
 Updated by:       [EMAIL PROTECTED]
 Reported By:      Er1c at comcast dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Scripting Engine problem
 Operating System: WinXP
 PHP Version:      5.0.0b4 (beta4)
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

You need to set the variables with $this-> too in your constructor.


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

[2004-03-01 17:38:24] Er1c at comcast dot net

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:


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


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

Reply via email to