ID: 28194 User updated by: email at philbert dot nl Reported By: email at philbert dot nl -Status: Feedback +Status: Open Bug Type: Class/Object related Operating System: Linux PHP Version: 4.3.4 New Comment:
When hardcoding an array, this problem does not seem to appear, so it seems related to the use of database functionality. Is there a way to create a lifelike result resource without actually using a database? Previous Comments: ------------------------------------------------------------------------ [2004-04-28 09:07:01] [EMAIL PROTECTED] Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If possible, make the script source available online and provide an URL to it here. Try avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2004-04-27 22:34:49] email at philbert dot nl Description: ------------ class RSSitem { var $dblink; var $success = false; var $items; var $currentItem; function RSSitem($pDBname, $pUsername, $pPassword) { $this->$dblink = mysql_connect("localhost:3306",$pUsername, $pPassword); if (mysql_select_db($pDBname, $this->$dblink)) { $query = "select id " . " , title " . " , description " . " , guid " . " , link " . " , pubDate " . "from item " . "order by id desc"; $this->$items = mysql_query($query, $this->$dblink); if ($this->$items) { $this->$currentItem = mysql_fetch_assoc($this->$items); if ($this->$currentItem) { $this->success = true; //print_r($this->$currentItem); } } } } function title() { $value = $this->$currentItem["title"]; return $value; } } When an object of class RSSitem is made, and the function object.title() is called, it returns the entire array $this->$currentItem, instead of entry ["title"] of this array. When I rewrite the function thus: function title() { $temparray = $this->$currentItem; $value = $temparray["title"]; return $value; } it does work. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=28194&edit=1