#33397 [NEW]: Passing cass variable by reference makes variable become reference
| From: | nikolaeff at gmail dot com | Date: | Sun, 19 Jun 2005 04:57:11 +0000 |
| Subject: | #33397 [NEW]: Passing cass variable by reference makes variable become reference | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-80621@lists.php.net to get a copy of this message | ||
From: nikolaeff at gmail dot com
Operating system: Linux
PHP version: 4.3.11
PHP Bug Type: Scripting Engine problem
Bug description: Passing cass variable by reference makes variable become reference
Description:
------------
Guess that $site->config shouldn't became reference after it passed to
method by reference. Am i right ?
Reproduce code:
---------------
class Config {}
class Database {
function Database(&$config) {} /* here */
}
class Site {
var $config;
var $db;
function Site() {
$this->config = new Config();
/* turns $this->config to a reference: */
$this->db = new Database($this->config);
}
}
$site = new Site();
var_dump($site);
Expected result:
----------------
object(site)(2) {
["config"]=>
object(config)(0) {
}
["db"]=>
object(database)(0) {
}
}
Actual result:
--------------
object(site)(2) {
["config"]=>
&object(config)(0) {
}
["db"]=>
object(database)(0) {
}
}
--
Edit bug report at http://bugs.php.net/?id=33397&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33397&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33397&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33397&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33397&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33397&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33397&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33397&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33397&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33397&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33397&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33397&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33397&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33397&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33397&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33397&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33397&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33397&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33397&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33397&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33397&r=mysqlcfg