Skip to content

Message::append on a repeated field causes segfault, batch assigning it throws exception #33

@dcelasun

Description

@dcelasun

I've spent the past 2 hours debugging this. Consider the following proto files:

package wom2.protobuf.messages;

import "webUser.proto";

message SomeMessage
{
    repeated WebUser users = 1;
}

and this one:

package wom2.protobuf.messages;

message WebUser
{
    required int64 id = 1;
    optional int64 fbid = 2;
    optional string ios_gcid = 3;
    optional string and_gpid = 4;
    required bool active = 5;
    optional int32 server_id = 6;
    optional string name = 7;
}

Now, $webUsers is an array of WebUser instances. The following works:

foreach ($webUsers as $u)
{
    $someMessage->appendUsers($u);
}

But the following segfaults:

foreach ($webUsers as $u)
{
    $someMessage->append('users', $u);
}

So I tried batch assigning it:

$someMessage->setFrom(array('users' => $webUsers));

// or this one...

new SomeMessage(array('users' => $webUsers));

which threw this exception:

1Ай9яяя   does not find

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions