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
dd519098
Commit
dd519098
authored
Aug 21, 2017
by
Bo Yang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use message name as defined in php runtime.
parent
26ac3e8e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
1 deletion
+25
-1
GPBUtil.php
php/src/Google/Protobuf/Internal/GPBUtil.php
+1
-1
Message.php
php/src/Google/Protobuf/Internal/Message.php
+3
-0
generated_class_test.php
php/tests/generated_class_test.php
+12
-0
memory_leak_test.php
php/tests/memory_leak_test.php
+2
-0
test.proto
php/tests/proto/test.proto
+7
-0
No files found.
php/src/Google/Protobuf/Internal/GPBUtil.php
View file @
dd519098
...
...
@@ -270,7 +270,7 @@ class GPBUtil
$name
,
$file_proto
)
{
$classname
=
implode
(
'_'
,
array_map
(
'ucwords'
,
explode
(
'.'
,
$name
)
));
$classname
=
implode
(
'_'
,
explode
(
'.'
,
$name
));
return
static
::
getClassNamePrefix
(
$classname
,
$file_proto
)
.
$classname
;
}
...
...
php/src/Google/Protobuf/Internal/Message.php
View file @
dd519098
...
...
@@ -76,6 +76,9 @@ class Message
}
$pool
=
DescriptorPool
::
getGeneratedPool
();
$this
->
desc
=
$pool
->
getDescriptorByClassName
(
get_class
(
$this
));
if
(
is_null
(
$this
->
desc
))
{
user_error
(
get_class
(
$this
)
.
"is not found in descriptor pool."
);
}
foreach
(
$this
->
desc
->
getField
()
as
$field
)
{
$setter
=
$field
->
getSetter
();
if
(
$field
->
isMap
())
{
...
...
php/tests/generated_class_test.php
View file @
dd519098
...
...
@@ -14,6 +14,8 @@ use Foo\TestIncludePrefixMessage;
use
Foo\TestMessage
;
use
Foo\TestMessage_Sub
;
use
Foo\TestReverseFieldOrder
;
use
Foo\testLowerCaseMessage
;
use
Foo\testLowerCaseEnum
;
use
Php\Test\TestNamespace
;
class
GeneratedClassTest
extends
TestBase
...
...
@@ -715,4 +717,14 @@ class GeneratedClassTest extends TestBase
$this
->
assertSame
(
"abc"
,
$m
->
getB
());
$this
->
assertNotSame
(
"abc"
,
$m
->
getA
());
}
#########################################################
# Test Reverse Field Order.
#########################################################
public
function
testLowerCase
()
{
$m
=
new
testLowerCaseMessage
();
$n
=
testLowerCaseEnum
::
VALUE
;
}
}
php/tests/memory_leak_test.php
View file @
dd519098
...
...
@@ -23,6 +23,8 @@ require_once('generated/Foo/TestPhpDoc.php');
require_once
(
'generated/Foo/TestRandomFieldOrder.php'
);
require_once
(
'generated/Foo/TestReverseFieldOrder.php'
);
require_once
(
'generated/Foo/TestUnpackedMessage.php'
);
require_once
(
'generated/Foo/testLowerCaseMessage.php'
);
require_once
(
'generated/Foo/testLowerCaseEnum.php'
);
require_once
(
'generated/GPBMetadata/Proto/Test.php'
);
require_once
(
'generated/GPBMetadata/Proto/TestEmptyPhpNamespace.php'
);
require_once
(
'generated/GPBMetadata/Proto/TestInclude.php'
);
...
...
php/tests/proto/test.proto
View file @
dd519098
...
...
@@ -192,3 +192,10 @@ message TestReverseFieldOrder {
repeated
int32
a
=
2
;
string
b
=
1
;
}
message
testLowerCaseMessage
{
}
enum
testLowerCaseEnum
{
VALUE
=
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