Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
9372292b
Commit
9372292b
authored
Sep 23, 2016
by
Stanley Cheung
Committed by
Bo Yang
Oct 10, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PHP: support 7.0 on PHP implementation (#2162)
* PHP: support 7.0 * Also fix in test_util.php
parent
f933d10f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
22 deletions
+27
-22
Message.php
php/src/Google/Protobuf/Internal/Message.php
+24
-21
test_util.php
php/tests/test_util.php
+3
-1
No files found.
php/src/Google/Protobuf/Internal/Message.php
View file @
9372292b
...
...
@@ -81,41 +81,44 @@ class Message
switch
(
$value_field
->
getType
())
{
case
GPBType
::
MESSAGE
:
case
GPBType
::
GROUP
:
$
this
->
$setter
(
new
MapField
(
$key
_field
->
getType
(),
$value_field
->
getType
(),
$value_field
->
getMessageType
()
->
getClass
())
);
$
map_field
=
new
MapField
(
$key_field
->
getType
(),
$value
_field
->
getType
(),
$value_field
->
getMessageType
()
->
getClass
());
$this
->
$setter
(
$map_field
);
break
;
case
GPBType
::
ENUM
:
$
this
->
$setter
(
new
MapField
(
$key
_field
->
getType
(),
$value_field
->
getType
(),
$value_field
->
getEnumType
()
->
getClass
())
);
$
map_field
=
new
MapField
(
$key_field
->
getType
(),
$value
_field
->
getType
(),
$value_field
->
getEnumType
()
->
getClass
());
$this
->
$setter
(
$map_field
);
break
;
default
:
$this
->
$setter
(
new
MapField
(
$key_field
->
getType
(),
$value_field
->
getType
()));
$map_field
=
new
MapField
(
$key_field
->
getType
(),
$value_field
->
getType
());
$this
->
$setter
(
$map_field
);
break
;
}
}
else
if
(
$field
->
getLabel
()
===
GPBLabel
::
REPEATED
)
{
switch
(
$field
->
getType
())
{
case
GPBType
::
MESSAGE
:
case
GPBType
::
GROUP
:
$
this
->
$setter
(
new
RepeatedField
(
$field
->
getType
(),
$field
->
getMessageType
()
->
getClass
())
);
$
repeated_field
=
new
RepeatedField
(
$field
->
getType
(),
$field
->
getMessageType
()
->
getClass
());
$this
->
$setter
(
$repeated_field
);
break
;
case
GPBType
::
ENUM
:
$
this
->
$setter
(
new
RepeatedField
(
$field
->
getType
(),
$field
->
getEnumType
()
->
getClass
())
);
$
repeated_field
=
new
RepeatedField
(
$field
->
getType
(),
$field
->
getEnumType
()
->
getClass
());
$this
->
$setter
(
$repeated_field
);
break
;
default
:
$this
->
$setter
(
new
RepeatedField
(
$field
->
getType
()));
$repeated_field
=
new
RepeatedField
(
$field
->
getType
());
$this
->
$setter
(
$repeated_field
);
break
;
}
}
else
if
(
$field
->
getOneofIndex
()
!==
-
1
)
{
...
...
php/tests/test_util.php
View file @
9372292b
...
...
@@ -50,6 +50,8 @@ class TestUtil
public
static
function
setTestMessage
(
TestMessage
$m
)
{
$sub
=
new
TestMessage_Sub
();
$m
->
setOptionalInt32
(
-
42
);
$m
->
setOptionalInt64
(
-
43
);
$m
->
setOptionalUint32
(
42
);
...
...
@@ -66,7 +68,7 @@ class TestUtil
$m
->
setOptionalString
(
'a'
);
$m
->
setOptionalBytes
(
'b'
);
$m
->
setOptionalEnum
(
TestEnum
::
ONE
);
$m
->
setOptionalMessage
(
new
TestMessage_Sub
()
);
$m
->
setOptionalMessage
(
$sub
);
$m
->
getOptionalMessage
()
->
SetA
(
33
);
$m
->
getRepeatedInt32
()
[]
=
-
42
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment