Mantis - Quercus
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
3232 | minor | always | 01-09-09 07:43 | 01-09-09 16:47 | |
|
|||||
Reporter: | haplo | Platform: | |||
Assigned To: | nam | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | 3.2.1 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in Version: | 4.0.0 | ||
|
|||||
Summary: | 0003232: PostIncrement doesn't work when fields are accessed using magic getter and setter methods | ||||
Description: |
If a member field is accessed using the php magic getter and setter method the post increment doesnt work on thoes fields Test: <?php class method_test { private $number; public function __construct(){ $this->number = 4; } public function getNumber(){ return $this->number; } public function setNumber($value){ $this->number = $value; } public function __get($value){ $getter='get'.$value; if(method_exists($this,$getter)) { return $this->$getter(); } throw new Exception("Method ('$getter') does not exists"); } public function __set($name, $value){ $setter='set'.$name; if(method_exists($this,$setter)) { $this->$setter($value); } else { throw new Exception("Method ('$setter') does not exists"); } } } /* 1. Test does work! */ $test = new method_test(); echo '1. Number: ' . $test->Number . ''; $test->Number = $test->Number +1; echo '2. Number: ' . $test->Number . ''; echo 'Number is 5? ' . ($test->Number == 5 ? 'Yes' : 'No'); /* 2. Test doesn't work */ $test = new method_test(); echo '1. Number: ' . $test->Number . ''; $test->Number ++; echo '2. Number: ' . $test->Number . ''; echo 'Number is 5? ' . ($test->Number == 5 ? 'Yes' : 'No'); |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|