Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003232 [Quercus] minor always 01-09-09 07:43 01-09-09 16:47
Reporter haplo View Status public  
Assigned To nam
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.0 Product Version 3.2.1
  Product Build
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
Attached Files

- Relationships

- Notes
(0003714)
nam
01-09-09 16:47

php/09kp
php/09kq
php/39kp
php/39kq
 

- Issue History
Date Modified Username Field Change
01-09-09 07:43 haplo New Issue
01-09-09 09:40 nam Status new => assigned
01-09-09 09:40 nam Assigned To  => nam
01-09-09 16:47 nam Status assigned => closed
01-09-09 16:47 nam Note Added: 0003714
01-09-09 16:47 nam Resolution open => fixed
01-09-09 16:47 nam Fixed in Version  => 4.0.0


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