Commit Graph

436 Commits

Author SHA1 Message Date
Paul Yang
a32c2d0306
Initialize well known type values (#6713)
* Initialize well known type values

Also fixes #6667

* Revert unwanted change
2019-09-30 14:43:03 -07:00
Nikhil Pothuru
11a5b035da Update README.md (#6708)
* Update README.md

Fixed spelling error

* Update README.md
2019-09-29 19:49:17 -07:00
Paul Yang
66bae588dd
Add document for php development (#6694)
* Add document for php development

* Fix comments
2019-09-26 13:04:07 -07:00
Paul Yang
3f323c5b99
Fix incorrect leap day for Timestamp in php (#6696) 2019-09-24 18:26:02 -07:00
Rafi Kamal
33151f2c87
Merge pull request #6647 from rafi-kamal/3.10.x-201909121347
Update protobuf version to 3.10.0 stable
2019-09-18 15:32:09 -07:00
Jie Luo
2a4657971d
Update to 3.10.0-rc0 (#6660)
* Cherry pick changes on update_version.py #6643

* Update version to 3.10.0-rc-0

* Do not add rc0 to php packages.xml
2019-09-18 13:30:03 -07:00
Paul Yang
2610eb6675
Add license (#6651) 2019-09-16 15:35:53 -07:00
Rafi Kamal
5021cd3419 Update protobuf version 2019-09-12 13:50:24 -07:00
Rafi Kamal
63fc281046 Update protobuf version 2019-09-05 10:15:17 -07:00
Rafi Kamal
4e07b6347d
Merge pull request #6618 from TeBoring/3.10.x-cherrypick
Cherry Pick (#6614)
2019-09-05 09:53:25 -07:00
Rafi Kamal
56bf637221 Update protobuf version 2019-09-05 09:47:52 -07:00
Paul Yang
398d37f95f Sync upb (#6614)
* Sync upb

https://github.com/protocolbuffers/upb/pull/209

* Update upb

https://github.com/protocolbuffers/upb/pull/210
2019-09-05 09:10:01 -07:00
Paul Yang
7f520092d9
Sync upb (#6614)
* Sync upb

https://github.com/protocolbuffers/upb/pull/209

* Update upb

https://github.com/protocolbuffers/upb/pull/210
2019-09-04 14:41:27 -07:00
Paul Yang
e9d4e4acbc
Fix the issue for parsing zero length message (#6592)
* When length is zero, substr returns null instead of emptry string, which breaks the invariable for message.
* Tested in https://github.com/protocolbuffers/protobuf/pull/6560
2019-08-30 10:47:25 -07:00
Wang Qilin
829bb1d791 fix no check for null pointer in encode_decode.c (#6578) 2019-08-29 15:35:14 -07:00
Paul Yang
342ae0ebc3
Fix issues for php map when parsing missing key/value (#6588)
* 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
2019-08-29 15:27:48 -07:00
Paul Yang
659e799fb8
Sync upb (#6577)
* Sync upb

* https://github.com/protocolbuffers/upb/pull/208

* Fix php c extension compiling

Don't use macros defined by upb

* Update ruby conformance failure list
2019-08-27 13:14:57 -07:00
Paul Yang
6b3024f693
Accept string for int64 wrappers (#6491) 2019-08-19 17:16:58 -07:00
Jie Luo
43156775be
Merge 3.9.x 201908071359 to master (#6484)
* 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)
2019-08-09 13:21:18 -07:00
Paul Yang
56988bee34
No free when construct was not done (#6483)
* No free when construct was not done

This fix the segfault when some other error happens

* Add more tests

* Use Sub to avoid printing too much
2019-08-07 13:17:20 -07:00
Jie Luo
d1eeb852fc
compatibility test between last released and current for java python php (#6441)
* compatibility tests between last released and the current version
2019-07-31 17:49:26 -07:00
Bo Yang
d581c76063 Merge branch 'master' into 3.9.x
Conflicts:
	java/lite/pom.xml
	java/util/pom.xml
2019-06-21 20:31:00 +00:00
Paul Yang
54288a01ce
Rename get/setXXXValue to get/setXXXUnwrapped (#6295) 2019-06-21 13:25:23 -07:00
Bo Yang
bc742640ef Merge remote-tracking branch 'origin/3.8.x' 2019-06-21 04:01:45 +00:00
Paul Yang
815ff7e1fb
Revert "Append field number to accessors if there is conflict (#6169)" (#6282)
This reverts commit 9a8ef05a34.
2019-06-20 20:59:48 -07:00
Paul Yang
7f84a94366
Make php message class final to avoid mocking (#6277)
* 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
2019-06-18 17:12:55 -07:00
Leonard Hecker
43307d4da0 php: Fix formatting of Duration (#6155)
* 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.
2019-06-18 10:31:50 -07:00
Paul Yang
640423f157
Change int64 json encoding to be string for php and ruby (#6251)
* Change int64 json encoding to be string for php and ruby

* Fix ruby test

* Sync upb change
2019-06-17 13:14:27 -07:00
Hao Nguyen
638720274b Update version to 3.9.0 2019-06-17 09:34:50 -07:00
Hao Nguyen
634d704d23 Merge branch '3.8.x' into 3.8.x-201905311515 2019-05-31 15:18:39 -07:00
Hao Nguyen
09745575a9
Merge pull request #6160 from haon4/3.8.x-20190521140707
Update protobuf version to 3.8.0
2019-05-24 11:06:49 -07:00
Paul Yang
95c207f24e
Add use_nested to internalAddGeneratedFile for php implementation (#6117) 2019-05-24 10:01:58 -07:00
Paul Yang
9a8ef05a34
Append field number to accessors if there is conflict (#6169)
Previously, foo_value and foo (wrapper field) will both have get/setFooValue
2019-05-24 10:00:09 -07:00
Hao Nguyen
582927ae2a Update generated files 2019-05-21 16:42:33 -07:00
Hao Nguyen
b0d648664d Update protobuf version 2019-05-21 14:07:13 -07:00
Hao Nguyen
46d5cc7de5 Revert "Revert "Add new file to package.xml (#6116)""
This reverts commit 783971e872.
Revert an accidental revert!
2019-05-21 13:50:54 -07:00
Hao Nguyen
2352a30e66 Revert "Update protobuf version"
This reverts commit 6d96493b31.
2019-05-21 13:49:06 -07:00
Hao Nguyen
783971e872 Revert "Add new file to package.xml (#6116)"
This reverts commit c40018e52d.
2019-05-21 13:48:34 -07:00
Hao Nguyen
6d96493b31 Update protobuf version 2019-05-21 13:31:01 -07:00
Paul Yang
c40018e52d
Add new file to package.xml (#6116) 2019-05-17 15:19:46 -07:00
Paul Yang
7597f8ad24
Custom mktime to fix issue on mac (#6118)
* Custom mktime to fix issue on mac

* Remove succeeded tests from failure list
2019-05-09 20:51:35 -07:00
Hao Nguyen
a56b529832 Update php/release.sh to be executable and create a new branch for the new version 2019-05-06 12:58:01 -07:00
Hao Nguyen
37a89f8e1a Update version to 3.8.0 2019-04-23 16:14:52 -07:00
Hao Nguyen
3d69bad4b2 Update generated proto and remove a test from failure_list 2019-04-10 13:33:56 -07:00
Bo Yang
cd044e9cbb Sync latest upb changes 2019-03-27 18:15:24 +00:00
Adam Cozzette
8645d893ab Merge branch '3.7.x' into merge-3-7-x 2019-03-26 14:32:20 -07:00
Paul Yang
6973c3a504
Update version number to 3.7.1 (#5947)
* Update version number to 3.7.1

* Update version number in port_def.inc
2019-03-26 09:30:12 -07:00
Benjamin Peterson
5939bc3619 Fix "the the". 2019-03-25 13:38:06 -07:00
Paul Yang
ba42cb53d9
Allow bytes field to be longer than 16000 bytes (#5924)
* Allow bytes field to be longer than 16000 bytes

* Remove empty line
2019-03-25 10:51:18 -07:00
Paul Yang
57b6597f46
Replace strptime with custom implementation (#5906)
* Replace strptime with custom implementation

* Fix ruby strptime

* Fix test

* Fix ruby conformance test

* Use mktime

* Remove EmptyFieldMask from failed conformance test list
2019-03-19 22:27:13 -07:00
David Supplee
d65b8647f2 Add terminating character to zend_lookup_class call (#5871) (#5885)
* add terminating character

* adjust name length input

* add test cases

* correct script name

* Misc fixes

* add new script to EXTRA_DIST list
2019-03-13 13:31:55 -07:00
Paul Yang
207d01daa1
Remove GPBWrapperUtil from generated code (#5880)
* Remove GPBWrapperUtil from generated code

* Add newline
2019-03-12 22:33:13 -07:00
David Supplee
93533f780b Add terminating character to zend_lookup_class call (#5871)
* add terminating character

* adjust name length input

* add test cases

* correct script name

* Misc fixes

* add new script to EXTRA_DIST list
2019-03-12 21:30:06 -07:00
Paul Yang
4b145b1c7f
Parse nested listvalue in json for ruby (#5867)
* Add conformance test for nested listvalue

* Fix upb for parsing repeated Value/ListValue

* Add failed repeated ListValue conformance test into php failure list
2019-03-12 10:56:58 -07:00
Joshua Haberman
f5e8ee41dd
PHP updates for new upb APIs (#5604) 2019-03-06 12:04:17 -08:00
Bo Yang
cb6fa92ee8 Merge branch '3.7.x' 2019-03-04 10:18:18 -08:00
Paul Yang
582743bf40
Update version number to 3.7.0 (#5793)
* Update version number to 3.7.0

* Add php/releash.sh to Makefile.am

* Make cpp_distcheck exit on fail
2019-02-28 12:55:14 -08:00
Yilun Chong
af8b91b828 fix csharp by regenerate descriptor 2019-02-26 13:07:59 -08:00
Paul Yang
0aad5339ca
Add a script to mirror php changes to protobuf-php (#5778)
* Add a script to mirror php changes to protobuf-php

* Create tag
2019-02-26 09:25:37 -08:00
Paul Yang
5d8cd3b895
Date and time need to be before version (#5777) 2019-02-25 15:13:59 -08:00
Bo Yang
b52754b719 Update version to 3.7.0rc3 2019-02-22 11:31:48 -08:00
Xiang Dai
e479410564 delete all duplicate empty blanks (#5758)
Signed-off-by: Xiang Dai <764524258@qq.com>
2019-02-20 19:28:50 -08:00
Paul Yang
c7b3392201
Update version to 3.7.0 (#5749)
* Update version to 3.7.0

* Update version number for java bom
2019-02-19 15:54:45 -08:00
michaelbausor
3c387ea7e5 PHP: Exclude repeated and map fields from normalization in constructor (#5723)
* Exclude repeated and map fields from normalization

* Remove erroneous comments

* Remove unnecessary check for map type

* Add support for repeated/map fields, add tests

* Fix wrapper message in repeated/map fields in array constructor

* Address PR comments

* Removed unused code

* Update docs
2019-02-15 16:18:27 -08:00
michaelbausor
3bf05b88ea PHP: Exclude repeated and map fields from normalization in constructor (#5723)
* Exclude repeated and map fields from normalization

* Remove erroneous comments

* Remove unnecessary check for map type

* Add support for repeated/map fields, add tests

* Fix wrapper message in repeated/map fields in array constructor

* Address PR comments

* Removed unused code

* Update docs
2019-02-15 16:16:42 -08:00
Paul Yang
43f8ae8708
Fix oneof message in array constructor (#5727) 2019-02-14 08:57:12 -08:00
Paul Yang
a1332ae3ce
RC release should use beta for api version (#5695) 2019-02-07 13:14:50 -08:00
Paul Yang
15fc6401b6
Update php version number to 3.7.0RC2 (#5666)
* Update php version number to 3.7.0RC2

* Update version number in source code
2019-02-01 12:31:44 -08:00
Adam Cozzette
1ee15baefc Updated version to 3.7.0rc2 2019-01-30 21:08:04 -08:00
Bo Yang
96029f3c4a Convert integer to string if field is string field in json
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.
2019-01-28 20:57:51 +00:00
Paul Yang
3cae8e4467 Default values should also be serialized for json map key/value (#5643) 2019-01-28 19:30:10 +00:00
Paul Yang
a21caa237a
Default values should also be serialized for json map key/value (#5643) 2019-01-28 11:25:52 -08:00
Paul Yang
53a1d49633
Allow internalAddGeneratedFile to depend on new nested message name (#5629)
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.
2019-01-24 19:10:00 -08:00
Hao Nguyen
d5be2baa46 Update version to 3.7.0 2019-01-24 10:23:02 -08:00
Paul Yang
d750fbf648
Fix more issues for reference values (#5613)
* Fix more issues for reference values

* Revert change in gdb test

* Add more tests
2019-01-23 12:44:20 -08:00
Paul Yang
7f42d6d0bc
Fix empty FieldMask json encoding/decoding (#5605)
* Fix empty FieldMask json encoding/decoding

* Add failed test to python's conformance failure list
2019-01-22 15:35:12 -08:00
Paul Yang
1069565a68
Fix c extension doesn' allow message reference in array (#5599)
* Fix c extension doesn' allow message reference in array

* Fix array constructor handling reference of array.

* Change test name
2019-01-22 14:02:44 -08:00
Joshua Haberman
dd7127d23d Fixed compile warnings for PHP extension. (#5589)
* Fixed compile warnings for PHP extension.

* Fixed some compile errors on PHP <7 and with TSR enabled.

* One more fix for TSRM builds.
2019-01-18 15:05:57 -08:00
Paul Yang
c4f2a92c55
Fix field mask for php in json (#5591)
* Fix field mask for php in json

* Update byte size
2019-01-17 10:18:43 -08:00
Nicolás Elliott
54683e607b Fix Issue #5345 (#5381)
Added a few \ on the comments to match the exceptions scope when is referenced while in a namespace. So the IDEs can be happy.
2019-01-12 10:25:07 -08:00
Paul Yang
11c979b591
Fix Empty ListValue/Struct json encoding (#5532)
* Fix Empty ListValue/Struct json encoding

* Add test for empty ListValue
2019-01-08 14:11:33 -08:00
Paul Yang
8faa778add
Fix Any json encoding/decoding in php (#5496)
* Fix Any json encoding/decoding in php

* Fix comments
2018-12-26 10:36:09 -08:00
Paul Yang
d7c4409589
Php 7.3 fix (#5434)
* 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
2018-12-18 10:57:03 -08:00
Paul Yang
cecba296b8
Down-integrate internal changes (#5467)
* Down-integrate internal changes

* Update generated code for php, objc and csharp.

* Add missing dependency in conformance_php
2018-12-14 16:05:03 -08:00
Hao Nguyen
9349e23827 Replace update_version shell script with a python script, which is much better at handling XML rewrite. Update the PHP version too. As part of rewrite, some XML file format will change a little, but the semantics is still the same so it should be okay. 2018-12-14 15:05:48 -08:00
michaelbausor
0b9af83dae PHP: Add Enum methods for converting to/from strings (#5342)
* 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
2018-11-28 16:44:53 -08:00
Adam Cozzette
86d4fe47df Updated checked-in generated code 2018-11-09 11:35:34 -08:00
Paul Yang
d2d4b403b5
Sync upb for unknown fix (#5240) 2018-10-12 13:46:26 -07:00
michaelbausor
6a51c03823 PHP: Add support for primitive types in setters (#5126)
* 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
2018-10-07 16:56:41 -07:00
Paul Yang
9bda1f19bf
Adopt upb change for timestamp and duration json to php (#5106)
* 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.
2018-09-22 18:57:43 -07:00
Feng Xiao
e49bd66034 Merge remote-tracking branch 'google/3.6.x' 2018-09-07 17:49:20 -07:00
Paul Yang
d05926861b
Fix well known type class not inheriting Message (#5095)
* 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
2018-08-31 10:48:17 -07:00
Feng Xiao
afe98de32a Replace repo links. 2018-08-22 11:55:30 -07:00
Joshua Haberman
585b24e9a6
Merge pull request #5032 from TeBoring/json-wrapper
Fix json parsing of wrapper values
2018-08-13 13:36:08 -07:00
Bo Yang
e3ee7167f1 Fix json parsing of wrapper values 2018-08-10 18:09:02 +00:00
Feng Xiao
a4862e790e Update generated descriptors. 2018-08-08 17:21:04 -07:00
Paul Yang
770dde7d31
Update php package.xml to 3.6.1 (#5000) 2018-08-03 16:26:18 -07:00
johnlow95
e9a5412afc adding of hyperlink of the PHP (#4985) 2018-08-02 19:49:44 -07:00
Adam Cozzette
94d55e5292 Merge branch '3.6.x' into merge-3-6-x 2018-08-01 13:44:55 -07:00
Adam Cozzette
9e1286b949 Updated version numbers to 3.6.1 2018-07-27 13:30:28 -07:00
Timothy Younger
5134f1a340 Update Composer config in PHP module (#3829)
* 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
2018-07-23 13:33:23 -07:00
Leonard Hecker
e7746f487c php: Added nanosecond support for Timestamp (#3972)
* php: Added nanosecond support for Timestamp

* php: Fixed compatibility test
2018-07-20 13:03:00 -07:00
Paul Yang
fc90fd6df1
Make assertEquals pass for message (#4947)
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.
2018-07-20 11:03:46 -07:00
Bo Yang
b23429ea32 Fix 32bit php tests 2018-07-15 21:01:48 -07:00
Bo Yang
8758cc1606 Fix php tests 2018-07-15 21:01:48 -07:00
Bo Yang
d779301670 Fix 32bit php tests 2018-07-13 09:10:16 +00:00
Bo Yang
51c188c2cc Fix php tests 2018-07-13 05:47:10 +00:00
Paul Yang
22503a0172
fix for API change in PHP 7.3 (#4898) 2018-07-12 12:34:18 -07:00
吕海涛
3beb19945b add JSON_UNESCAPED_UNICODE option (#4191) 2018-07-09 17:00:02 -07:00
Paul Yang
26eeec93e4
Enable ignoring unknown in json parsing in php (#4839)
* Enable ignoring unknown in json parsing in php

* Update generated descriptor files

* Update failure list for other languages.

* Remove unnecessary php files
2018-07-09 14:29:23 -07:00
Adam Cozzette
d6f346b4d5
Merge pull request #4827 from acozzette/merge-3-6-x
Merge 3.6.x branch into master
2018-06-25 15:52:29 -07:00
Pat Moroney
d65d5821bc rename duplicate testMessageSetNullFail function (#3669)
the testMessageSetNullFail function was declared twice.
So I renamed one to testMessageSetNullFailMap
2018-06-25 14:57:40 -07:00
Vladimir Kovpak
7402555f34 Improved install command. (#4106)
Added `-y` flag to `sudo apt-get` command.
2018-06-25 14:20:21 -07:00
Adam Cozzette
82d3d7d250 Merge branch '3.6.x' into merge-3-6-x 2018-06-25 13:22:10 -07:00
Paul Yang
ce044817c7
Use legacy name in php runtime (#4741)
* 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
2018-06-07 18:16:44 -07:00
Paul Yang
d6353b489e
Update php version to 3.6.0 (#4736) 2018-06-06 19:04:25 -07:00
Paul Yang
5bf35ecca2 Fix php memory leak test (#4692) 2018-05-29 10:27:32 -07:00
Paul Yang
7d1a8fff1b
Fix php memory leak test (#4692) 2018-05-29 10:25:05 -07:00
Paul Yang
dadc95438f Fix array constructor in c extension for compatibility (#4667)
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.
2018-05-25 13:04:29 -07:00
Brent Shaffer
2774e5441d PHP namespaces for nested messages and enums (#4536)
* 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
2018-05-25 13:04:19 -07:00
Bo Yang
8b336f8c5a Implement array constructor in php c extension. 2018-05-25 13:04:08 -07:00
Brent Shaffer
c9b404d23b PHP array constructors for protobuf messages (#4530)
* 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
2018-05-25 13:03:58 -07:00
Paul Yang
d8483a92d7 Adopt php_metadata_namespace in php code generator (#4622)
* 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
2018-05-25 13:02:29 -07:00
Paul Yang
00d32539c6 Fix array constructor in c extension for compatibility (#4667)
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.
2018-05-24 13:39:41 -07:00
Brent Shaffer
6737954661 PHP namespaces for nested messages and enums (#4536)
* 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
2018-05-24 13:39:41 -07:00
Bo Yang
839f71e305 Implement array constructor in php c extension. 2018-05-24 13:39:41 -07:00
Brent Shaffer
f1911f37f8 PHP array constructors for protobuf messages (#4530)
* 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
2018-05-24 13:39:41 -07:00
Adam Cozzette
6ecc87666d Updated PHP generated code for timestamp.proto 2018-05-17 14:36:03 -07:00
Paul Yang
3d9e99b7e0
Adopt php_metadata_namespace in php code generator (#4622)
* 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
2018-05-14 16:08:47 -07:00
Paul Yang
b61dd9d9a2
Add file option php_metadata_namespace and ruby_package (#4609) 2018-05-11 13:57:06 -07:00
Paul Yang
7377d81ca4
Throw error if user want to access message properties (#4603)
* Throw error if user want to access message properties

* Fix typo
2018-05-10 10:52:39 -07:00
Paul Yang
5f7334f5f3
Avoid direct check of class name (#4601)
* Avoid direct check of class name

So that subclasses are also ok

* Use type hint in function signature.
2018-05-10 10:52:00 -07:00
Petar Dambovaliev
0869b1a0a7 Add space between class name and concat message (#4577)
The class name was linked to the next word in the sentence.
"User\UserRequestis not found in descriptor pool."
2018-04-30 11:00:46 -07:00
urfinjuezz
d7d863ea07 fix json_decode call parameters (#4381) 2018-04-09 14:14:31 -07:00
Brent Shaffer
13e627ad69 includes the expected class in the exception, otherwise the error is harder to track down (#3371) 2018-04-09 14:08:58 -07:00
Paul Yang
c931743461
Merge branch (#4466)
* Fix setup.py for windows build.

* Bump version number to 3.5.2

* Cat the test-suite.log on errors for presubits
2018-04-02 15:55:28 -07:00
Paul Yang
6dd563a674
Sync upb change (#4373) 2018-03-08 17:35:22 -08:00
Paul Yang
a48d58df96
Convert descriptortype to type for upb_msgval_sizeof (#4357) 2018-03-06 15:07:05 -08:00
Paul Yang
0f4ad85740
For encoding upb needs descriptor type instead of type. (#4354) 2018-03-06 13:30:03 -08:00
Adam Cozzette
5004d09ff0 PHP: fixed typo in message.c 2018-03-05 14:25:42 -08:00
Jisi Liu
bb40c0c0c4
Merge pull request #4291 from google/3.5.x
Merge 3.5.x to master
2018-02-26 10:05:09 -08:00
Paul Yang
51293f36d8
Fix more memory leak for php c extension (#4211)
* Fix more memory leak for php c extension

* Fix memory leak for php5.5
2018-01-25 11:31:05 -08:00
Paul Yang
3823897475
Well known types are not initialized properly. (#4139)
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.
2018-01-05 13:05:07 -08:00
Jisi Liu
383a4941d5 Merge remote-tracking branch 'origin/3.5.x' into master 2018-01-03 09:28:40 -08:00
Paul Yang
c79ba5c1b6
Merge pull request #4034 from TeBoring/php-timestamp-bug
Avoid calling method from php extension directly
2017-12-15 10:36:07 -08:00
Bo Yang
8d6f13e86d Fix for php5.5 2017-12-14 13:24:00 -08:00
Bo Yang
39159c89f1 Accept DatetimeInterface in fromDatetime 2017-12-14 11:33:34 -08:00
Bo Yang
1a549d9a90 Avoid using php_date_get_date_ce() in case date extension is not
available.
2017-12-13 17:09:55 -08:00
Bo Yang
fffe8d39f8 Call php method via function name instead of calling directly.
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.
2017-12-12 17:47:04 -08:00
Paul Yang
f69a5db66f
Merge pull request #4028 from TeBoring/3.5.x
Add backslach to make class explict in global namespace
2017-12-12 14:28:27 -08:00
Bo Yang
88102eae8f Replace private timelib_update_ts with public date_timestamp_get 2017-12-12 13:57:49 -08:00
Bo Yang
9f6aceaa8c Add PROTOBUF_ENABLE_TIMESTAMP to let user decide whether timestamp util
can be used at install time.
2017-12-12 12:06:51 -08:00
Bo Yang
3b13c3f02e Add backslach to make class explict in global namespace 2017-12-11 15:44:27 -08:00
Bo Yang
fc5818b2bb Merge branch '3.5.0.1' into 3.5.x 2017-12-11 10:50:50 -08:00
Paul Yang
c370f88fb1
Recursively clear unknown fields in submessages. (#3982)
* 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.
2017-12-07 11:16:47 -08:00
Bo Yang
457f6a607c Add release log 2017-12-06 10:54:11 -08:00
Bo Yang
ba60b854b6 Update php c extension version number to 3.5.0.1 2017-12-06 10:46:57 -08:00
Bo Yang
212563d756 Fix memory leak in php7 2017-12-06 10:40:07 -08:00
Bo Yang
3b7a5f4515 Fix several more memory leak 2017-12-06 10:38:18 -08:00
Bo Yang
7d3437152a Fix memory leak when creating map field via array. 2017-12-06 10:37:53 -08:00
Bo Yang
e0d3aa057b Fix memory leak when creating repeated field via array. 2017-12-06 10:37:26 -08:00
Paul Yang
de44982a74 Remove duplicate typedef. (#3975) 2017-12-06 10:36:52 -08:00
Bo Yang
b140cb3145 Fix memory leak when creating map field via array. 2017-12-04 12:32:10 -08:00
Bo Yang
1acacf46cc Fix memory leak when creating repeated field via array. 2017-12-01 20:14:57 -08:00
Adam Cozzette
a27da09339 Merge branch '3.5.x' into 3.5.x-merge 2017-11-30 13:34:51 -08:00
Paul Yang
94bb1eed17
Remove duplicate typedef. (#3975) 2017-11-30 12:21:00 -08:00
Paul Yang
74e7decbbf
Provide discardUnknonwnFields API in php (#3976)
* Provide discardUnknownFields API in php implementation

* Provide discardUnknownFields API in php c extension.
2017-11-30 12:19:50 -08:00
Paul Yang
98836a56e6
Update version number for php c extension (#3896) 2017-11-15 17:17:36 -08:00
Paul Yang
857a021645
Use fully qualifed name for DescriptorPool in Any.php to avoid name (#3886)
conflict
2017-11-15 11:09:14 -08:00
Issac Trotts
0d466884a2 Update README.md: C extension works on PHP 7 (#3888)
Here's the pull request that made it happen: https://github.com/google/protobuf/pull/2951
2017-11-15 11:08:15 -08:00
Paul Yang
188f18044f
All integer types should accept null in json. (#3869) 2017-11-13 09:31:28 -08:00
Paul Yang
2df472690e
Fix php well known type conformance tests (#3828) (#3840)
* 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
2017-11-04 09:33:56 -07:00
Paul Yang
bcda919cee
Fix php well known type conformance tests (#3828)
* 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
2017-11-03 12:30:09 -07:00
xuwei-k
05b56d01c1 update joda-time javadoc url 2017-10-30 17:48:54 +09:00
Jisi Liu
ecf2957106 Update descriptor protos 2017-10-18 14:21:22 -07:00
Jisi Liu
de15e73d58 Merge remote-tracking branch 'origin/3.4.x' into master 2017-10-11 14:44:03 -07:00
Paul Yang
6032746882 Reserve unknown fields in php (#3659)
* 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
2017-10-09 12:39:13 -07:00
Paul Yang
77f64bb777 Add well known types to php runtime. (#3697)
* 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
2017-10-05 21:03:57 -07:00
Paul Yang
ae55fd2cc5 Enforce all error report for php tests. (#3670)
* Enforce all error report for php tests.

* Import vendor/autoload.php in tests/bootstrap_phpunit.php
2017-09-22 14:08:01 -07:00
Paul Yang
2b0ee3fdf6 Add $ before url_prefix_len to make it a variable. (#3668)
* Add $ before url_prefix_len to make it a variable.

* Remove unnecessary string length check

* Remove useless $type_url_len
2017-09-20 22:59:13 -07:00
Paul Yang
5dd818cd22 Merge pull request #3612 from TeBoring/php-bug
Add prefix to php reserved keywords.
2017-09-15 09:20:23 -07:00
Jisi Liu
dba647a6b2 Bump version for minor release 2017-09-14 11:12:55 -07:00
Adam Cozzette
13fd045dbb Integrated internal changes from Google 2017-09-14 10:03:57 -07:00
Bo Yang
f46a01d0c1 Exclude valid constant name from reserved name. 2017-09-12 15:04:34 -07:00
Bo Yang
ddb9ef9cc3 Change array to map for reserved names in c extension 2017-09-11 15:51:57 -07:00
Bo Yang
89069ded5a Change array to associate array. 2017-09-11 12:30:24 -07:00
Jack Wakefield
174c82d8ce Add well-known timestamps to JSON for PHP (#3564) 2017-09-10 15:17:50 -07:00
Bo Yang
e5d000cbb7 Add prefix to php reserved keywords. 2017-09-08 15:17:36 -07:00
Paul Yang
7f8b91f552 Add native php support for Duration. (#3583) 2017-09-05 14:10:32 -07:00
Paul Yang
b70e0fdf09 Add php support for Timestamp. (#3575)
* Add php support for Timestamp.

* Fix comments
2017-08-31 10:35:31 -07:00
Paul Yang
2807436cd8 change the field number of php_generic_service to fix the conflict with (#3576)
internal descriptor.proto
2017-08-30 16:50:07 -07:00
Paul Yang
c7457ef65a Add any support in php runtime. (#3486)
* Add any support in php runtime.

* Remove unused file in config.m4

* Fix comments

* Fix error for tsrmls build

* Add newly added file to Makefile.am
2017-08-25 08:49:34 -07:00
Bo Yang
dd5190980b Use message name as defined in php runtime. 2017-08-21 13:39:15 -07:00
Bo Yang
e243082fe9 Update php version number to 3.4.0 2017-08-16 13:03:44 -07:00
Bo Yang
82dd4b3793 Update php c extension version number. 2017-08-16 13:00:50 -07:00
Bo Yang
8f4b8e430a Merge branch 'master' into 3.4.x 2017-08-05 10:42:29 -07:00
Paul Yang
49b44bff2b Fix the bug in php c extension that setting one field can change another field's value. (#3455)
* 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
2017-08-04 16:35:49 -07:00
michaelbausor
21b0e5587c Update PHP descriptors (#3391)
* 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
2017-08-04 16:35:22 -07:00
Paul Yang
25672c1757 Add getClass for php Descriptor in c extension (#3443) 2017-08-02 18:33:25 -07:00
Ryan Gordon
9df89ccabc Fixing HHVM Compatibility (#3437) 2017-08-02 07:43:27 -07:00