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
282fb9e6
Commit
282fb9e6
authored
May 29, 2017
by
Paul Yang
Committed by
GitHub
May 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ARRAY for reserved name (#3150)
parent
4d5daf4e
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
7 deletions
+13
-7
def.c
php/ext/google/protobuf/def.c
+2
-2
descriptor.php
php/src/Google/Protobuf/descriptor.php
+1
-1
generated_class_test.php
php/tests/generated_class_test.php
+3
-2
memory_leak_test.php
php/tests/memory_leak_test.php
+1
-0
test.proto
php/tests/proto/test.proto
+4
-0
php_generator.cc
src/google/protobuf/compiler/php/php_generator.cc
+2
-2
No files found.
php/ext/google/protobuf/def.c
View file @
282fb9e6
...
...
@@ -30,8 +30,8 @@
#include "protobuf.h"
const
char
*
const
kReservedNames
[]
=
{
"Empty"
};
const
int
kReservedNamesSize
=
1
;
const
char
*
const
kReservedNames
[]
=
{
"Empty"
,
"ECHO"
,
"ARRAY"
};
const
int
kReservedNamesSize
=
3
;
// Forward declare.
static
void
descriptor_init_c_instance
(
Descriptor
*
intern
TSRMLS_DC
);
...
...
php/src/Google/Protobuf/descriptor.php
View file @
282fb9e6
...
...
@@ -236,7 +236,7 @@ function getClassNamePrefix(
return
$prefix
;
}
$reserved_words
=
array
(
"Empty"
);
$reserved_words
=
array
(
"Empty"
,
"ECHO"
,
"ARRAY"
);
foreach
(
$reserved_words
as
$reserved_word
)
{
if
(
$classname
===
$reserved_word
)
{
if
(
$file_proto
->
getPackage
()
===
"google.protobuf"
)
{
...
...
php/tests/generated_class_test.php
View file @
282fb9e6
...
...
@@ -876,6 +876,7 @@ class GeneratedClassTest extends TestBase
$m
=
new
\Foo\TestMessage_Empty
();
$m
=
new
\Foo\PBEmpty
();
$m
=
new
\PrefixEmpty
();
$m
=
new
\Foo\PBARRAY
();
}
#########################################################
...
...
@@ -886,8 +887,8 @@ class GeneratedClassTest extends TestBase
{
$m
=
(
new
TestMessage
())
->
setOptionalInt32
(
1
)
->
setOptional
Int64
(
2
);
->
setOptional
UInt32
(
2
);
$this
->
assertSame
(
1
,
$m
->
getOptionalInt32
());
$this
->
assertSame
(
2
,
$m
->
getOptional
Int64
());
$this
->
assertSame
(
2
,
$m
->
getOptional
UInt32
());
}
}
php/tests/memory_leak_test.php
View file @
282fb9e6
...
...
@@ -8,6 +8,7 @@ require_once('generated/NoNamespaceMessage_NestedEnum.php');
require_once
(
'generated/PrefixEmpty.php'
);
require_once
(
'generated/PrefixTestPrefix.php'
);
require_once
(
'generated/Bar/TestInclude.php'
);
require_once
(
'generated/Foo/PBARRAY.php'
);
require_once
(
'generated/Foo/PBEmpty.php'
);
require_once
(
'generated/Foo/TestEnum.php'
);
require_once
(
'generated/Foo/TestIncludePrefixMessage.php'
);
...
...
php/tests/proto/test.proto
View file @
282fb9e6
...
...
@@ -127,6 +127,10 @@ message Empty {
int32
a
=
1
;
}
message
ARRAY
{
int32
a
=
1
;
}
message
TestPackedMessage
{
repeated
int32
repeated_int32
=
90
[
packed
=
true
];
repeated
int64
repeated_int64
=
91
[
packed
=
true
];
...
...
src/google/protobuf/compiler/php/php_generator.cc
View file @
282fb9e6
...
...
@@ -49,8 +49,8 @@ const std::string kDescriptorMetadataFile =
"GPBMetadata/Google/Protobuf/Internal/Descriptor.php"
;
const
std
::
string
kDescriptorDirName
=
"Google/Protobuf/Internal"
;
const
std
::
string
kDescriptorPackageName
=
"Google
\\
Protobuf
\\
Internal"
;
const
char
*
const
kReservedNames
[]
=
{
"Empty"
,
"ECHO"
};
const
int
kReservedNamesSize
=
2
;
const
char
*
const
kReservedNames
[]
=
{
"
ARRAY"
,
"
Empty"
,
"ECHO"
};
const
int
kReservedNamesSize
=
3
;
namespace
google
{
namespace
protobuf
{
...
...
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