ID: 44649 Updated by: [EMAIL PROTECTED] Reported By: j dot amel83 at gmail dot com -Status: Open +Status: Bogus Bug Type: Class/Object related Operating System: Windows MCE (Zend Core) PHP Version: 5.2.5 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. Due to the volume of reports we can not explain in detail here why your report is not a bug. The support channels will be able to provide an explanation for you. Thank you for your interest in PHP. $this->object = ... Previous Comments: ------------------------------------------------------------------------ [2008-04-06 07:14:13] j dot amel83 at gmail dot com Description: ------------ I got Catchable fatal error when I want to pass an object as a __construct method args and assign it to a class property. PHP try to convert my object to string before assignment. Reproduce code: --------------- <?php require_once '../../RAPI/autoload.php'; class ActionController { /** * TransactionScript Reference * * @var TransactionScript */ public $object; /** * Method name * * @var String */ public $method; /** * Method parameters * * @var Array */ public $params = array(); /** * Response Name * * @var String */ public $responseName; /** * @param TransactionScript $object * @param String $method * @param Array $params * @param String $responseName */ public function __construct(TransactionScript $object, $method, Array $params, $responseName) { $this->$object = $object; $this->$method = $method; $this->$params = $params; $this->$responseName = $responseName; } } $a = new ActionController(new LongtermAlon(), 'sayHello', array(), 'sname'); echo $a->responseName; ?> Expected result: ---------------- sname Actual result: -------------- Catchable fatal error: Object of class LongtermAlon could not be converted to string in C:\Inetpub\Refah\testArea\ActionController.php on line 42 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44649&edit=1