From: victor at equillon dot ro
Operating system: Linux
PHP version: 5.2.6
PHP Bug Type: Class/Object related
Bug description: String concatenation with class attribute
Description:
------------
When concatenating a string with an attribute of a class, the attribute is
considered to be void or something. It doesn't always run like that.
It can be fixed by doing this:
echo "Monster ".($this->monsters[0]->name)." hit something";
Reproduce code:
---------------
class Monster {
public $name;
}
class test {
private $monsters;
public function init() {
for ($i=0; $i<100; $i++) {
$this->monsters[$i] = new Monster();
$this->monsters[$i]->name = "test";
}
}
public function test() {
echo "Monster ".$this->monsters[0]->name." hit something";
}
}
$abc = new test();
$abc->init();
$abc->test();
Expected result:
----------------
Monster test hit something
Actual result:
--------------
Monster hit something
--
Edit bug report at http://bugs.php.net/?id=46401&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=46401&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=46401&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=46401&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=46401&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=46401&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=46401&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=46401&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=46401&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=46401&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=46401&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=46401&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=46401&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=46401&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=46401&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=46401&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=46401&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=46401&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=46401&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=46401&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=46401&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=46401&r=mysqlcfg