Open
Description
When initialize a message with an invalid array, the first invalid key of the given array will be changed to an exception. Segmentation fault also.
Message definition
message Person
{
required bytes name = 1;
required uint32 age = 2;
}
PHP test code
require 'person.proto.php';
$info = [
'fake_name' => 'bryce',
'age' => 18
];
var_dump($info);
$person = new Person();
try {
$person->setFrom($info);
} catch (Exception $e) {
}
var_dump($info);
PHP output
array(2) {
'fake_name' =>
string(5) "bryce"
'age' =>
int(18)
}
array(2) {
'fake_name' =>
class InvalidArgumentException#4 (8) {
protected $message =>
string(23) "fake_name does not find"
private $string =>
string(0) ""
protected $code =>
int(0)
protected $file =>
string(32) "/home/bryceliu/c/person/test.php"
protected $line =>
int(10)
private $trace =>
array(1) {
[0] =>
array(6) {
...
}
}
private $previous =>
NULL
public $xdebug_message =>
string(279) "
InvalidArgumentException: fake_name does not find in /home/bryceliu/c/person/test.php on line 10
Call Stack:
0.0002 223440 1. {main}() /home/bryceliu/c/person/test.php:0
0.0013 252648 2. ProtocolBuffersMessage->setFrom() /home/bryceliu/c/person/test.php:10
"
}
'age' =>
int(18)
}
Segmentation fault
Metadata
Metadata
Assignees
Labels
No labels