PHP CodeGen misses inherited properties

Hi,

The PHP Xml-Rpc CodeGen does not seem to include properties from ancestor structures. In below code, MyStruct inherits from BaseStruct.

class BaseStruct {
    public $Name; // AnsiString

    function BaseStruct() {}
    static function FromXmlRpcVal($n) {
        $res = new BaseStruct();
        $res->Name = $n->structmem("Name")->scalarval();
        return $res;
    }
    static function ToXmlRpcVal($data) {
        $res = new xmlrpcval();
        $arr = array();
        $arr["Name"] = new xmlrpcval($data->Name, "string");
        $res->addStruct($arr);
        return $res;
    }
    static function FromArray($data)
    {
        $items = array();
        for ($i = 0; $i < sizeof($data); $i++) {
            $items[$i] = BaseStruct::ToXmlRpcVal($data[$i]);
        }
        $res = new xmlrpcval();
        $res->addArray($items);;
        return $res;
    }
    static function ToArray($data)
    {
        $items = array();
        for ($i = 0; $i < $data->arraysize(); $i++) $items[$i] = BaseStruct::FromXmlRpcVal($data->arraymem($i));
        return $items;
    }
}

class MyStruct {
    public $Surname; // AnsiString

    function MyStruct() {}
    static function FromXmlRpcVal($n) {
        $res = new MyStruct();
        $res->Surname = $n->structmem("Surname")->scalarval();
        return $res;
    }
    static function ToXmlRpcVal($data) {
        $res = new xmlrpcval();
        $arr = array();
        $arr["Surname"] = new xmlrpcval($data->Surname, "string");
        $res->addStruct($arr);
        return $res;
    }
    static function FromArray($data)
    {
        $items = array();
        for ($i = 0; $i < sizeof($data); $i++) {
            $items[$i] = MyStruct::ToXmlRpcVal($data[$i]);
        }
        $res = new xmlrpcval();
        $res->addArray($items);;
        return $res;
    }
    static function ToArray($data)
    {
        $items = array();
        for ($i = 0; $i < $data->arraysize(); $i++) $items[$i] = MyStruct::FromXmlRpcVal($data->arraymem($i));
        return $items;
    }
}

how it should generated?
can you show a small example, pls?

Hi, I am not a PHP developer but it should be something like below.

MyStruct should extend BaseStruct and include the properties from BaseStruct in serialisation.

I found and commented on another item where it says this is already logged as issue #58287

class MyStruct extends BaseStruct {
    public $Surname; // AnsiString
    
    static function FromXmlRpcVal($n) {
        $res = new MyStruct();
        $res->Name = $n->structmem("Name")->scalarval();
        $res->Surname = $n->structmem("Surname")->scalarval();
        return $res;
    }
    static function ToXmlRpcVal($data) {
        $res = new xmlrpcval();
        $arr = array();
        $arr["Name"] = new xmlrpcval($data->Name, "string");
        $arr["Surname"] = new xmlrpcval($data->Surname, "string");
        $res->addStruct($arr);
        return $res;
    }
    
    ...
}

#58287 isn’t fixed yet

Thanks. Will it be fixed? I see it was logged in 2012… This is causing many problems with 3rd party integrations to my API.

bugs://58287 got closed with status fixed.

Thanks! Can this made available in a Personal or Beta build for me to test the fix?

the fix will be in the incoming release (in a few days)