Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004260 [Quercus] minor sometimes 10-14-10 12:04 10-19-10 15:10
Reporter domdorn View Status public  
Assigned To
Priority normal Resolution open  
Status feedback   Product Version 4.0.11
Summary 0004260: Dynamic properties not working correctly
Description Dynamic properties do not behave the same as in native PHP (version ?)
<?php

class Foo {
  public function __construct() {}
}

class Bar {
  public $name = "Greg";
  public function __construct() {}
}

$foo = new Foo();
$foo->bar = new Bar();

echo "

TEST 1:
";
print_r($foo);
// Foo Object ( [bar] => Bar Object ( [name] => Greg ) )

echo "

TEST 2:
";
echo $foo->bar;
// Bar[]

echo "

TEST 3:
";
$barVariable = "bar";
echo $foo->$barVariable;
// Bar[]

echo "

TEST 4:
";
echo $foo->$barVariable->name;
// (blank)

echo "

TEST 5:
";
$testBarVar = $foo->$barVariable;
echo $testBarVar->name;
// Greg

echo "

TEST 6:
";
echo $foo->bar->name;
// Greg

?>

Additional information:
http://www.krisjordan.com/2008/11/27/dynamic-properties-in-php-with-stdclass/ [^]
Additional Information
Attached Files

- Relationships

- Notes
(0004793)
domdorn
10-14-10 12:10

Testcase is failing in zends php 5.3.3
domdorn php $ php test.php


TEST 1:
Foo Object
(
    [bar] => Bar Object
        (
            [name] => Greg
        )

)


TEST 2:
PHP Catchable fatal error: Object of class Bar could not be converted to string in /tmp/php/test.php on line 20
 
(0004794)
domdorn
10-14-10 13:20

Please provide
 - PHP version used in your environment (to reproduce your testcase)
 - estimated amount of code affected in your code base (to prioritize the issue correctly), e.g. if its just a change in 3 classes or if the whole codebase has to be altered.

thanks,
dominik
 
(0004796)
gbruins
10-19-10 15:10

We are using PHP 5.2.8

This bug affects some low level classes that most of our other classes depend on, so this is high priority for us.
 

- Issue History
Date Modified Username Field Change
10-14-10 12:04 domdorn New Issue
10-14-10 12:10 domdorn Note Added: 0004793
10-14-10 12:11 domdorn Status new => feedback
10-14-10 13:20 domdorn Note Added: 0004794
10-19-10 15:10 gbruins Note Added: 0004796
10-19-10 15:16 gbruins Issue Monitored: gbruins
10-27-10 09:24 kdecherf Issue Monitored: kdecherf


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