From: email at philbert dot nl
Operating system: Linux
PHP version: 4.3.4
PHP Bug Type: Class/Object related
Bug description: internal referencing of array entry seems flawed
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 bug report at http://bugs.php.net/?id=28194&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28194&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28194&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28194&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28194&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28194&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28194&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28194&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28194&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28194&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28194&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28194&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28194&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28194&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28194&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28194&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28194&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28194&r=float