#28194 [Opn->Fbk]: internal referencing of array entry seems flawed

From: Date: Wed, 28 Apr 2004 07:07:03 +0000
Subject: #28194 [Opn->Fbk]: internal referencing of array entry seems flawed
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-58921@lists.php.net to get a copy of this message
ID: 28194 Updated by: derick@php.net Reported By: email at philbert dot nl -Status: Open +Status: Feedback Bug Type: Class/Object related Operating System: Linux PHP Version: 4.3.4 New Comment: 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. Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#58921) next »