* Make reserve names map persistent
* Add DescriptorInternal to map
* Use get_msgdef_desc in encode_decode.c
* Add persistent map for ce=>def and enum=>def
* Replace get_ce_obj
* Remove get_proto_obj
* Remove obsolete fields from Descriptor and EnumDescriptor
* Add cache for descriptor php values
* Add cache for descriptors
* Fix bug
* Avoid add generated file again if it has been added
* Fix the bug upb depends on null-ended str for look up.
* Initialize generated pool impl
* Turn down old generated pool
* Add init entry flag protobuf.keep_descriptor_pool_after_request
By default, it's off. Add protobuf.keep_descriptor_pool_after_request=1 to php.ini to enable it
* Fix zts build
* Register additional handlers from wrappers
* Return zval instead of parse frame
* Use parse frame
* Update upb
* Lazily create wrapper messages
* Fix a segment fault
Need check type of field before getting submsg def
* Avoid expanding during serialization and direct access
* Fix a bug that getXXXUnwrapped returns null for string
* Implement writeWrapperUnwrapped
* Add more tests
* Fix oneof wrapper parsing
* Fix get oneof field
* Avoid expansion for oneof wrappers
* Fix bug
* Fix a bug that in php7 variable is defined out of scope
* Fix broken tests
* Update upb to fix Timestamp conformance tests
* Fix segmentation fault for oneof wrapper fields
* Fix encoding/decoding top level wrapper values
* Add type checking for write wrapper value in php7
* Fix zts build
* Fix the bug that readWrapperValue uses parent message's layout to access wrapper value
* Fix wrapper in map
* Avoid initializing primitive fields in layout_init
* Avoid initializing string/bytes/message fields in layout_init
* Lazily create map when needed
* Lazily create repeated fields
* Change layout_init to only do memcpy
* Fix test for php-7.0
* Fix conformance test where default value of string/message map is not encoded
* Fix test for zts
* Clean up
* Fix comments
* For missing message value, map should create a default message
instance in order to keep its invariable.
* On 32-bit platform, int64 map key should be string
* Add changelog for 3.9.x
* Revert "Make php message class final to avoid mocking (#6277)" (#6324)
This reverts commit 7f84a94366.
This is just temporary. Eventually, we still want to roll forward this
change. Some users are complaining they need more time to clean up their
code.
* Update extract_includes.bat.in
File io_win32.h is not in directory google\protobuf\stubs under directory google\protobuf\io
* Set oneof case in array constructor (#6351)
Forgot to set it previously.
* Update protobuf version (#6366)
* Drop building wheel for python 3.4 (#6406)
https://github.com/matthew-brett/multibuild/pull/240
* Fix binary compatibility in FieldCodec factory methods (#6380) (#6424)
* Fix binary compatibility in FieldCodec factory messages
* Make default value parameter for current factories required
* Route old methods through default value overloads
* Remove ExtensionRegistry.Add(params) overload
* Rename ExtensionRegistry.Add(IEnumerable<Extension>) overload to AddRange
* Edit naming of parameters in Extension classes
* * Fix add API warnings to docs for extension APIs
* Rename internal ExtensionSet.GetValue to TryGetValue
* Disable javadoc error (#6371)
* Disable javadoc error
Actual fixes of the javadoc will be followed up
* Remove duplicated configuration
* Update javadoc plugin version
* Updated Bazel test script to use most recent Bazel version (#6413) (#6433)
I'm not exactly sure why, but this fixes the failing Bazel presubmit
test. Using the most recent version seems like a good idea anyway so
that we can make sure we're compatible with any new Bazel changes.
* [bazel] Add fixes for --incompatible_load_{cc,java,proto}_rules_from_bzl
* No need to update version in generated code (#6471)
generate_descriptor will handle that
* Update protobuf version (#6472)
* Make php message class final
Because proto messages are just data object, they should not be mocked.
Explicitly make them final to avoid accidental usage.
* Update generated descriptors
* php: Fixed php notices for unknown enum indices
* php: Fixed formatting of Duration
This fixes:
* Missing nanoseconds. The nanoseconds where divided as a float and
implicitly converted to a string before being passed to bcadd.
This can result in a float formatted in scientific/exponential notation,
which bcmath doesn't understand.
* Durations are supposed to be formatted without trailing zeroes.
* Replace strptime with custom implementation
* Fix ruby strptime
* Fix test
* Fix ruby conformance test
* Use mktime
* Remove EmptyFieldMask from failed conformance test list
* Add conformance test for nested listvalue
* Fix upb for parsing repeated Value/ListValue
* Add failed repeated ListValue conformance test into php failure list
json_decode automatically convert numeric string to integer, so that
we need to convert it back. However, this will suceed to parse invalid
json data with string field set as integer even though it should have failed.
Because, the failure case is less often than the succeeding case, we decided
to make this change. Users should make sure their data don't use integer for
string fields by themselves.
Previously, internalAddGeneratedFile has to depend on old non-nested name for sub-messages.
This creates a hard dependency on old generated code for compatibility usage.
If user's code has custome error handler, the deprecation warning in the old generated code
will also be thrown (even though users haven't explicitly depended on the old message name).
To fix this problem, this change added an additional flag in the generated code to tell run
time that it's safe to use new message name. In this way, internalAddGeneratedFile can safely
depend on new name and don't trigger unnecessary deprecation warning.
* Inherit from message instead of implement
When regestering class (implmenets other class) during MINIT, zend_class_implements
would call zend_class_entry->interface_gets_implemented(). In PHP-7.3 interface_gets_implemented shares the same location with create_object.
However, during MINIT, the global object storeage hasn't been initialized. And thus, caused segment fault in php 7.3.
* Use zend_string_init where interned string may be the value.
zend_string_dup will keep using the existing interned string.
In php 7.3, interned string cannot be destroyed from user's code.
* Uncommment debug code
* Use latest phpunit for each php versions
* Revert change in Dockerfile
* Update php test to use the new docker image
* Update composer
* Change docker organization
* Update phpunit
* Debug phpunit
* Store phpunit into bin dir in docker image
* Install valgrind to docker
* Fix compatibility test
* Remove generated_service_test from compatibility c extension test
* Update 32bit php test to the new docker image
* Install bison
* Fix build.sh
* Fix DOCKERIMAGE_PREFIX
* Fix basename
* Add comment to build_and_run_docker2.sh
* Remove commented code
* Fix comments
* adds string-to-int and int-to-string methods to enums
* remove check for valueToName property in EnumTrait
* Remove unused imports
* Update to avoid using EnumTrait
* Remove EnumTrait
* Update enum types
* Move name and value methods into generated classes
* Remove functions from GPBUtil
* Test well known enums
* Implement enum value to/from name in c extension
* Only generate use statement when namespace is present
* Add support for primitive types in setters
* Update to address PR feedback
* Add tests and fixes for repeated fields
* Remove repeated field code, add getters
* Cleanup, test getters and oneofs
* Move boxing logic into separate class
* Add tests for wrapper type constructor args
* Update to add new setXXXValue methods
* Fix tests for invalid values
* Fix c extension for wrapper accessors
* Fix the bug that well known types didn't call Message_construct
* Address PR comments
* Refactoring init message with array logic
* Add include path to protoc
* Add missing TSRM_LS defintion
* Fix TSRM_LS
* Fix dist check
* Adopt upb change for timestamp and duration json to php
* Remove unused code
* Re-sync upb
* Fix php implementation timestamp json parsing
* Fix strptime use local timezone on mac.
* Remove succeeding tests
* Resync
* Add tests for values
* Fix php tests
* Fix encoder handlers change default value
Previously, oneofsubmsg_handler and submsg_handler change zval's default value directly.
The fix use REPLACE_ZVAL_VALUE which create a copy of parsed value and assign it to zval.
* 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.