| Anonymous | Login | Signup for a new account | 11-08-2025 11:23 PST |
| Main | My View | View Issues | Change Log | Docs |
| Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ 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 | |||||||||
| Status | assigned | Product Version | 4.0.13 | |||||||||
| 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 |
|||||||||||
| Additional Information | ||||||||||||
| Attached Files | ||||||||||||
|
|
||||||||||||
| There are no notes attached to this issue. |
| Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed. 25 unique queries executed. |