Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004310 [Quercus] major always 11-30-10 12:32 03-22-12 13:41
Reporter gspeicher View Status public  
Assigned To
Priority normal Resolution open Platform
Status assigned   OS
Projection none   OS Version
ETA none Fixed in Version Product Version 4.0.13
  Product Build
Summary 0004310: inconsistent behavior for declared attributes when accessed from member functions versus public member access
Description Declaring attributes in user-defined classes results in the following problematic situation:

class A {
  public $x = 1;
  public function __construct() {
    $this->x = 2;
  }
  public function foo() {
    return $this->x;
  }
}

$a = new A();
print "a.x: " . $a->x . "
\n";
print "a.foo(): " . $a->foo() . "
\n";


class B {
  # note no declaration for x
  public function __construct() {
    $this->x = 2;
  }
  public function foo() {
    return $this->x;
  }
}

$b = new B();
print "b.x: " . $b->x . "
\n";
print "b.foo(): " . $b->foo() . "
\n";


Expected output:
a.x: 2
a.foo(): 2
b.x: 2
b.foo(): 2

Actual output:
a.x: 1
a.foo(): 2
b.x: 2
b.foo(): 2
Steps To Reproduce
Additional Information
Attached Files

- Relationships

There are no notes attached to this issue.

- Issue History
Date Modified Username Field Change
11-30-10 12:32 gspeicher New Issue
11-30-10 12:39 gspeicher Issue Monitored: gspeicher
02-04-11 02:01 domdorn Status new => assigned
02-04-11 02:01 domdorn Assigned To  => domdorn
03-22-12 13:41 domdorn Assigned To domdorn =>


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker