Mantis - Quercus
Viewing Issue Advanced Details
3966 major always 03-24-10 22:11 06-19-12 14:55
Rogiel  
nam  
normal  
closed 4.0.6  
unable to reproduce  
none    
none  
0003966: Setting array values using field name as another field
When setting an field into an array, Quercus set the entire array as the value of the field. Resulting in the loss of the array.

This problem is preventing vBulletin from posting new threads in Quercus.
<?php
$test = new BugTest();

echo "Before Setting: ";
print_r($test->testField);
echo "
";

$test->set('a', 'A');
$test->set('b', 'B');

echo "After Setting: ";
print_r($test->testField);

class BugTest {
    var $field = "testField";
    
    function BugTest() {
        $this->{$this->field} = array();
    }
    
    function set($key, $value) {
        $this->{$this->field}[$key] = $value;
    }
}
?>
 test.php [^] (408 bytes) 03-24-10 22:11

Notes
(0005888)
nam   
06-19-12 14:55   
Unable to reproduce on trunk (upcoming 4.0.29).

Results:
Before Setting: Array
(
)

After Setting: Array
(
    [a] => A
    [b] => B
)