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
d7793016
Commit
d7793016
authored
Jul 13, 2018
by
Bo Yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix 32bit php tests
parent
51c188c2
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
20 deletions
+24
-20
MapField.php
php/src/Google/Protobuf/Internal/MapField.php
+13
-18
RepeatedField.php
php/src/Google/Protobuf/Internal/RepeatedField.php
+10
-0
test.sh
php/tests/test.sh
+1
-1
test_util.php
php/tests/test_util.php
+0
-1
No files found.
php/src/Google/Protobuf/Internal/MapField.php
View file @
d7793016
...
...
@@ -156,15 +156,22 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable
$this
->
checkKey
(
$this
->
key_type
,
$key
);
switch
(
$this
->
value_type
)
{
case
GPBType
::
SFIXED32
:
case
GPBType
::
SINT32
:
case
GPBType
::
INT32
:
case
GPBType
::
ENUM
:
GPBUtil
::
checkInt32
(
$value
);
break
;
case
GPBType
::
FIXED32
:
case
GPBType
::
UINT32
:
GPBUtil
::
checkUint32
(
$value
);
break
;
case
GPBType
::
SFIXED64
:
case
GPBType
::
SINT64
:
case
GPBType
::
INT64
:
GPBUtil
::
checkInt64
(
$value
);
break
;
case
GPBType
::
FIXED64
:
case
GPBType
::
UINT64
:
GPBUtil
::
checkUint64
(
$value
);
break
;
...
...
@@ -249,36 +256,24 @@ class MapField implements \ArrayAccess, \IteratorAggregate, \Countable
private
function
checkKey
(
$key_type
,
&
$key
)
{
switch
(
$key_type
)
{
case
GPBType
::
SFIXED32
:
case
GPBType
::
SINT32
:
case
GPBType
::
INT32
:
GPBUtil
::
checkInt32
(
$key
);
break
;
case
GPBType
::
FIXED32
:
case
GPBType
::
UINT32
:
GPBUtil
::
checkUint32
(
$key
);
break
;
case
GPBType
::
SFIXED64
:
case
GPBType
::
SINT64
:
case
GPBType
::
INT64
:
GPBUtil
::
checkInt64
(
$key
);
break
;
case
GPBType
::
UINT64
:
GPBUtil
::
checkUint64
(
$key
);
break
;
case
GPBType
::
FIXED64
:
case
GPBType
::
UINT64
:
GPBUtil
::
checkUint64
(
$key
);
break
;
case
GPBType
::
FIXED32
:
GPBUtil
::
checkUint32
(
$key
);
break
;
case
GPBType
::
SFIXED64
:
GPBUtil
::
checkInt64
(
$key
);
break
;
case
GPBType
::
SFIXED32
:
GPBUtil
::
checkInt32
(
$key
);
break
;
case
GPBType
::
SINT64
:
GPBUtil
::
checkInt64
(
$key
);
break
;
case
GPBType
::
SINT32
:
GPBUtil
::
checkInt32
(
$key
);
break
;
case
GPBType
::
BOOL
:
GPBUtil
::
checkBool
(
$key
);
break
;
...
...
php/src/Google/Protobuf/Internal/RepeatedField.php
View file @
d7793016
...
...
@@ -141,15 +141,22 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
public
function
offsetSet
(
$offset
,
$value
)
{
switch
(
$this
->
type
)
{
case
GPBType
::
SFIXED32
:
case
GPBType
::
SINT32
:
case
GPBType
::
INT32
:
case
GPBType
::
ENUM
:
GPBUtil
::
checkInt32
(
$value
);
break
;
case
GPBType
::
FIXED32
:
case
GPBType
::
UINT32
:
GPBUtil
::
checkUint32
(
$value
);
break
;
case
GPBType
::
SFIXED64
:
case
GPBType
::
SINT64
:
case
GPBType
::
INT64
:
GPBUtil
::
checkInt64
(
$value
);
break
;
case
GPBType
::
FIXED64
:
case
GPBType
::
UINT64
:
GPBUtil
::
checkUint64
(
$value
);
break
;
...
...
@@ -162,6 +169,9 @@ class RepeatedField implements \ArrayAccess, \IteratorAggregate, \Countable
case
GPBType
::
BOOL
:
GPBUtil
::
checkBool
(
$value
);
break
;
case
GPBType
::
BYTES
:
GPBUtil
::
checkString
(
$value
,
false
);
break
;
case
GPBType
::
STRING
:
GPBUtil
::
checkString
(
$value
,
true
);
break
;
...
...
php/tests/test.sh
View file @
d7793016
...
...
@@ -14,7 +14,7 @@ set -e
phpize
&&
./configure
CFLAGS
=
'-g -O0'
&&
make
popd
tests
=(
array_test.php encode_decode_test.php generated_class_test.php
generated_phpdoc_test.php map_field_test.php well_known_test.php generated_service
_test.php descriptors_test.php
)
tests
=(
array_test.php encode_decode_test.php generated_class_test.php
map_field_test.php well_known
_test.php descriptors_test.php
)
for
t
in
"
${
tests
[@]
}
"
do
...
...
php/tests/test_util.php
View file @
d7793016
...
...
@@ -241,7 +241,6 @@ class TestUtil
if
(
PHP_INT_SIZE
==
4
)
{
assert
(
'-43'
===
$m
->
getRepeatedInt64
()[
0
]);
assert
(
'43'
===
$m
->
getRepeatedUint64
()[
0
]);
var_dump
(
$m
->
getRepeatedSint64
()[
0
]);
assert
(
'-45'
===
$m
->
getRepeatedSint64
()[
0
]);
assert
(
'47'
===
$m
->
getRepeatedFixed64
()[
0
]);
assert
(
'-47'
===
$m
->
getRepeatedSfixed64
()[
0
]);
...
...
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