#28443 [Opn->Bgs]: Var is changed without a reason
| From: | alan_k@php.net | Date: | Wed, 19 May 2004 07:32:43 +0000 |
| Subject: | #28443 [Opn->Bgs]: Var is changed without a reason | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-59768@lists.php.net to get a copy of this message | ||
ID: 28443
Updated by: alan_k@php.net
Reported By: nitz at framingo dot de
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Win2k
PHP Version: 4.3.6
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
$this->$limit
$this->limit
you are using variable properties.. - effetcively setting $this->{''}
try running with error_reporting(E_ALL);
Previous Comments:
------------------------------------------------------------------------
[2004-05-19 09:28:56] nitz at framingo dot de
Description:
------------
Class constructor sets a var to a value that is only assigned to an
other var.
Reproduce code:
---------------
<?php
class FG_Timestamp{
var $timestamp;
var $limit;
function FG_Timestamp($ts=-1)
{
$this->$timestamp=0;
$this->$limit=1;
echo "1 val limit=".$this->$limit."<br>";
if ($ts<0)
$this->$timestamp=time();
else
$this->$timestamp=2;
echo "2 val limit=".$this->$limit."<br>";
}
}
$cmp=new FG_Timestamp(0);
?>
Expected result:
----------------
1 val limit=1
2 val limit=1
Actual result:
--------------
1 val limit=1
2 val limit=2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28443&edit=1