From:             j dot amel83 at gmail dot com
Operating system: Windows MCE (Zend Core)
PHP version:      5.2.5
PHP Bug Type:     Class/Object related
Bug description:  Object assignment error in __construct method

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 bug report at http://bugs.php.net/?id=44649&edit=1
-- 
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=44649&r=trysnapshot52
Try a CVS snapshot (PHP 5.3): 
http://bugs.php.net/fix.php?id=44649&r=trysnapshot53
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=44649&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=44649&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=44649&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=44649&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=44649&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=44649&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=44649&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=44649&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=44649&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=44649&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=44649&r=globals
PHP 4 support discontinued:   http://bugs.php.net/fix.php?id=44649&r=php4
Daylight Savings:             http://bugs.php.net/fix.php?id=44649&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=44649&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=44649&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=44649&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=44649&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=44649&r=mysqlcfg

Reply via email to