* Fix well known type class not inheriting Message
Previously, well known types only implement Message interface but not inhert it.
Fix the problem by calling zend_do_inheritance
* Add back commented tests
* Prevents installation of `phpunit/phpunit:^6` because the test cases in this project require `\PHPUnit_Framework_TestCase` which was removed in v6. Moves generated PHP classes for tests into autoload-dev so that they are not referenced in the dist autoload. Adds Composer scripts to run protoc with and without grpc.
* update composer test target to use the same commands as generate_php_test_proto in tests.sh
This change only makes assertEquals pass for message in c extension. However, it actually does nothing.
This is the same behavior before 3.6.0 release.
* Use legacy name in php runtime
Old generated code cannot work with new runtime, because the new runtime
assumes new class name for nested message. For details see #4738.
* Remove unused method
In old generated code, the constructor of message doesn't provide a
default null to parent's constructor. Previously, in c extesnion, this
case was not handled.
* uses namespaces for nested messages and enums
* fixes namespaces for PHP dist
* fixes namespace for Descriptors, adds Cardinality and Kind
* fixes nested namespaces for reserved words and adds tests
* adds tests and generator fix for php class prefixes
* fixes escaping of protobuf packages, enum comments, misc others
* nice refactor of generated code
* adds class files for backwards compatibility
* simplifies code with templates
* adds compatibility files to makefile
* cleanup of generator and fixes nested namespace bug
* regenerates proto types
* remove internal BC classes
* adds deprecated warning, adds methods back
* simplifies if statement
* fixes dist files
* addresses review comments
* adds back TYPE_URL_PREFIX constant
* adds @deprecated to old nested class files
* skips tests which require a separate process when protobuf.so is enabled
* Adds tests for legacy nested classes that do not require separate processes to test
* uses legacy names for GPBUtil message check
* adds block for IDE @deprecated message
* Namespace for nested message/enum in c extension
* Remove unused code
* PHP array constructors for protobuf messages
* removes Descriptor from error message
* allows mergeFrom to accept an array
* only use initWithDescriptor if instanceof MapEntry
* adds doc comments
* removes ability for constructors to take arrays for submessages
* Revert "allows mergeFrom to accept an array"
This reverts commit b7b72182d5.
* makes mergeFromArray protected and fixes mergeFrom whitespace
* Separates merging from JSON and merging from PHP array
* removes well-known types and json keys from array construction
* Addresses PR review comments
* cleans up tests
* fixes exception messages
* Adopt php_metadata_namespace in php code generator
The php_metadata_namespace is corresponded to the relative directory of
the metadata file. e.g., previously, the metadata file of foo.proto was
GPBMetadata/Foo.php. If the php_metadata_namespace is "Metadata\\Bar",
the metadata file will be Metadata/Bar/Foo.php.
* Handle empty php_metadata_namespace
In old generated code, the constructor of message doesn't provide a
default null to parent's constructor. Previously, in c extesnion, this
case was not handled.
* uses namespaces for nested messages and enums
* fixes namespaces for PHP dist
* fixes namespace for Descriptors, adds Cardinality and Kind
* fixes nested namespaces for reserved words and adds tests
* adds tests and generator fix for php class prefixes
* fixes escaping of protobuf packages, enum comments, misc others
* nice refactor of generated code
* adds class files for backwards compatibility
* simplifies code with templates
* adds compatibility files to makefile
* cleanup of generator and fixes nested namespace bug
* regenerates proto types
* remove internal BC classes
* adds deprecated warning, adds methods back
* simplifies if statement
* fixes dist files
* addresses review comments
* adds back TYPE_URL_PREFIX constant
* adds @deprecated to old nested class files
* skips tests which require a separate process when protobuf.so is enabled
* Adds tests for legacy nested classes that do not require separate processes to test
* uses legacy names for GPBUtil message check
* adds block for IDE @deprecated message
* Namespace for nested message/enum in c extension
* Remove unused code
* PHP array constructors for protobuf messages
* removes Descriptor from error message
* allows mergeFrom to accept an array
* only use initWithDescriptor if instanceof MapEntry
* adds doc comments
* removes ability for constructors to take arrays for submessages
* Revert "allows mergeFrom to accept an array"
This reverts commit b7b72182d5.
* makes mergeFromArray protected and fixes mergeFrom whitespace
* Separates merging from JSON and merging from PHP array
* removes well-known types and json keys from array construction
* Addresses PR review comments
* cleans up tests
* fixes exception messages
* Adopt php_metadata_namespace in php code generator
The php_metadata_namespace is corresponded to the relative directory of
the metadata file. e.g., previously, the metadata file of foo.proto was
GPBMetadata/Foo.php. If the php_metadata_namespace is "Metadata\\Bar",
the metadata file will be Metadata/Bar/Foo.php.
* Handle empty php_metadata_namespace
Previously, within the same load period of protobuf module, well known
types are not initialized correctly for the second request. The reason
is that well known type are only initialized if a method local static
variable is not set. However, that variable is not reset after request
ends. Therefore, when the second request comes, the method local static
variable is still set (by previous request) and well types are not
initialized in this case.
This changes the linking error if php extension is not statically linked
to a runtime error. In this way, users who don't need Timestamp can
still use protobuf even if date extension is not statically linked in
php.
* Recursively clear unknown fields in submessages.
* Recursively discard unknown fields in submsg for c extension
* Fix zts build
* Add comment for tests
* Add a TODO to add a util for encoding varint for better readability.
* Add test for oneof message field.
* Fix php well known type conformance tests
* Properly generate code for test.proto
* Provide GPBMetadata files in c extensions for generated files to import.
* Remove unnecessary test
* Clean up code
* Add declaration for initOnce.
* Refactoring
* Fix php well known type conformance tests
* Properly generate code for test.proto
* Provide GPBMetadata files in c extensions for generated files to import.
* Remove unnecessary test
* Clean up code
* Add declaration for initOnce.
* Refactoring
* Reserve unknown fields in upb
1) For decoding, an unknownfields will be lazily created on message,
which contains bytes of unknown fields.
2) For encoding, if the unknownfields is present on message, all bytes
contained in it will be serialized.
* Register the function to encode unknown field at decode time.
* Remove upb_handlers_setaddunknown
* Use upb_sink_putunknown in decoder
* Remove upb_pb_encoder_encode_unknown
* Do not expose encode_unknown
* Implement reserve unknown field in php Implement.
* Make buffer private to CodedInputStream
* Add well known types to php runtime.
* Fix php7.0 tests
* No longer generate empty.proto in test as it has been included in
runtime.
* Fix zts build
* Clean code
* Rename g_p_b_empty to empty.
* Don't generate code for empty.proto in compatibility test
* Fix 32-bit
* Fix mac build
* Fix Makefile.am to add new files
* Fix the bug in php c extension that setting one field can change another
field's value.
The reason is that previously, in c extension, it was assumed that the
order that fields were declared in php is the same as the order of
fields in upb. This is not true. Now, for every field in upb, we will
look up the actual property that is corresponding to the upb field.
* Cleanup pull request
* Fix indentation
* Port to php5
* Port with php7.1
* Port to zts
* Add descriptors test
* Update descriptors tests
* Add public descriptors
* Add test_desriptors.proto to test script
* Update composer files
* Remove references to GPBType, update tests to be compatible with c
* Update for c extension compatibility
* Remove nested enums for descriptor, update tests
* Strip leading '.' from descriptor name
* Update tests with test for getClass, fix OneofDescriptor
* Add new files to Makefile.am
divideInt64ToInt32 is called statically from protobuf/php/src/Google/Protobuf/Internal/CodedOutputStream.php
(the only reference)
This causes fatal error in PHP 7.1 (32-bit only because 64-bit doesn't use this function)
* Add php_generic_services option
* Generate PHP generic services
* Respect namespaces for generated PHP services
* Test PHP generated services
* Rename PHP generator service method doc comment function
* Correct phpdoc service method case
* Test namespaced PHP generic services
* Always use the FQCN for PHP generic service input/output
* Add generated_service_test to php test.sh
* Add php service test protos to CI
* Add php service files to php_EXTRA_DIST
* Use Interface suffix for php generic services
Both native_slot_merge and native_slot_merge_by_array have no return
type declared. GCC implicitly uses int as return type in such cases,
however, these functions are actually void.
In the generated code of previous versions, each php field is given an
initial value. In c extension, it was assumed that the field order in
the generated code is consistent with upb fields order, so that the
correct initial value can be bound to the correct upb field. However,
this may not be true. The order of fields in generated code is decided
by proto compiler, while the order of upb fields is decided by the hash
function used in c extension.
This PR fixes the issue by reset the initial value at runtime.
* adds PHPDoc @return and @param for getters and setters respectively
* addresses changes in PR review
* adds documentation tests
* Update php_generator:
- Prepend \ to names where required
- Remove <pre> tags
- Update protobuf field comments
* Updates class files with the protobuf changes
* Addresses review comments
* removes Protobuf Type line from PHP generated classes
* fixes phpdoc test
* adds array types to phpdoc
* Switch to addEnumType to fix fatal error
* Fixing more cases of HHVM incompatibility
* Updating tests to be hhvm compatible
* Fixing tests
* Fixing merge
* Don't use call_user_func, should hopefully fix tests
* Fixing spelling
* Fixing another misspelling in a test
* Fixing placement of append and kvUpdate functions
* Actually fix function helpers
* Remove double addEnumType. How did this ever work?
* Fixing a couple more tests
* Only use the setter if the return value isn't an object
* Follows proper autoloading standards
- Splits PHP classes in descriptor.php into separate files
- Splits MapFieldIter and RepeatedFieldIter into separate files
- Moves descriptor.php to Internal/functions.php
- Moves all namespaced functions into Iternal/functions.php
* fixes Makefile.am for added php files
* [PHP] moves all functions to GPBUtil
* removes description.php from the makefile
* Add new file option php_namespace.
Use this option to change the namespace of php generated classes.
Default is empty. When this option is empty, the package name will be
used for determining the namespace.
* Uncomment commented tests
* Revert gdb test change
* Update csharp descriptor.
* Add test for empty php_namespace.
descriptor.proto uses proto2 syntax, which is not ready for external
usage. However, some proto3 files import descriptor.proto and cannot be
used. In this PR, all references (We cheated by only removing
extensions, which is enough for now. User should avoid using messages
defined in descriptor.proto as field type.) to content in
descriptor.proto are removed from generated files. Those that import
descriptor.proto can be used like other proto files.
Accept regular PHP array for repeated/map setter. Existing map/repeated
field will be swapped by a clean map/repeated field. Then, elements in
the array will be added to the map/repeated field. All elements will be
type checked before adding.
See #2686 for detail.
This better shows the semantic of the API. For already setted fields,
mergeFromString do replacement for singular fields and appending for
repeated fields.
This method merges the contents of the specified message into the
current message. Singular fields that are set in the specified message
overwrite the corresponding fields in the current message. Repeated
fields are appended. Map fields key-value pairs are overritten.
Singular/Oneof sub-messages are recursively merged. All overritten
sub-messages are deep-copied.
* Down-integrate internal changes to github.
* Update conformance test failure list.
* Explicitly import used class in nano test to avoid random test fail.
* Update _GNUC_VER to use the correct implementation of atomic operation
on Mac.
* maps_test.js: check whether Symbol is defined before using it (#2524)
Symbol is not yet available on older versions of Node.js and so this
test fails with them. This change just directly checks whether Symbol is
available before we try to use it.
* Added well_known_types_embed.cc to CLEANFILES so that it gets cleaned up
* Updated Makefile.am to fix out-of-tree builds
* Added Bazel genrule for generating well_known_types_embed.cc
In pull request #2517 I made this change for the CMake and autotools
builds but forgot to do it for the Bazel build.
* Update _GNUC_VER to use the correct implementation of atomic operation on Mac.
* Add new js file in extra dist.
* Bump version number to 3.2.0
* Fixed issue with autoloading - Invalid paths (#2538)
* PHP fix int64 decoding (#2516)
* fix int64 decoding
* fix int64 decoding + tests
* Fix int64 decoding on 32-bit machines.
* Fix warning in compiler/js/embed.cc
embed.cc: In function ‘std::string CEscape(const string&)’:
embed.cc:51:32: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 0; i < str.size(); ++i) {
^
* Fix include in auto-generated well_known_types_embed.cc
Restore include style fix (e3da722) that has been trampled by
auto-generation of well_known_types_embed.cc
* Fixed cross compilations with the Autotools build
Pull request #2517 caused cross compilations to start failing, because
the js_embed binary was being built to run on the target platform
instead of on the build machine. This change updates the Autotools build
to use the AX_PROG_CXX_FOR_BUILD macro to find a suitable compiler for
the build machine and always use that when building js_embed.
* Minor fix for autocreated object repeated fields and maps.
- If setting/clearing a repeated field/map that was objects, check the class
before checking the autocreator.
- Just to be paranoid, don’t mutate within copy/mutableCopy for the autocreated
classes to ensure there is less chance of issues if someone does something
really crazy threading wise.
- Some more tests for the internal AutocreatedArray/AutocreatedDictionary
classes to ensure things are working as expected.
- Add Xcode 8.2 to the full_mac_build.sh supported list.
* Fix generation of extending nested messages in JavaScript (#2439)
* Fix generation of extending nested messages in JavaScript
* Added missing test8.proto to build
* Fix generated code when there is no namespace but there is enum definition.
* Decoding unknown field should succeed.
* Add embed.cc in src/Makefile.am to fix dist check.
* Fixed "make distcheck" for the Autotools build
To make the test pass I needed to fix out-of-tree builds and update
EXTRA_DIST and CLEANFILES.
* Remove redundent embed.cc from src/Makefile.am
* Update version number to 3.2.0-rc.1 (#2578)
* Change protoc-artifacts version to 3.2.0-rc.1
* Update version number to 3.2.0rc2
* Update change logs for 3.2.0 release.
* Update php README
* Update upb, fixes some bugs (including a hash table problem). (#2611)
* Update upb, fixes some bugs (including a hash table problem).
* Ruby: added a test for the previous hash table corruption.
Verified that this triggers the bug in the currently released
version.
* Ruby: bugfix for SEGV.
* Ruby: removed old code for dup'ing defs.
* Reverting deployment target to 7.0 (#2618)
The Protobuf library doesn’t require the 7.1 deployment target so
reverting it back to 7.0
* Fix typo that breaks builds on big-endian (#2632)
* Bump version number to 3.2.0
In php, class name cannot be "Empty". Modified code generator to (#2375) generate GPBEmpty instead (for google.protobuf.Empty only). Also change
runtime code to work with the new generated code accordingly.
This pull request includes two implementation: C extension and PHP
package. Both implementations support encode/decode of singular,
repeated and map fields.