Commit Graph

564 Commits

Author SHA1 Message Date
Joshua Haberman
05644f0313 Revert upb changes to minimize changes as we evaluate performance. 2020-10-05 22:31:50 -07:00
Joshua Haberman
ec4b194608 Regenerated protos with new script. 2020-10-05 22:27:56 -07:00
Joshua Haberman
cfc0c2b5e0 Passes all tests. 2020-10-05 22:24:34 -07:00
Joshua Haberman
a93d840881 WIP. 2020-10-01 23:17:10 -07:00
Joshua Haberman
a0eef68bbd Regenerated well-known types and moved hand-written messages into base classes. 2020-09-29 15:47:47 -07:00
Joshua Haberman
cae85a9f11
PHP: Added == operators for Map and Array. (#7900) 2020-09-22 11:44:52 -07:00
Joshua Haberman
f0942fb0a2
Equals passes tests in both pure-PHP and the C extension. (#7883) 2020-09-14 13:40:07 -07:00
Paul Yang
93d8e89374
Fix version number in php macro (#7822)
Fixes #7812
2020-08-17 12:58:35 -07:00
Adam Cozzette
cddcbb93f0 Fixed spelling (reenable -> re-enable) 2020-08-17 11:37:42 -07:00
Adam Cozzette
58f4260e8e Merged 3.13.x into master 2020-08-17 11:06:11 -07:00
Adam Cozzette
fde7cf7358 Update protobuf version 2020-08-14 15:20:53 -07:00
Adam Cozzette
98c2e69f8c Update protobuf version 2020-08-12 14:49:20 -07:00
Paul Yang
5ce6232605
No need to generate addtional has method for proto2 (#7802)
* No need to generate addtional has method for proto2

* Also remove has property
2020-08-12 13:18:28 -07:00
Paul Yang
d4ca92962c
Port php c extension to php8 (#7793)
* Only ported c extension to php8.
* Didn't fixed the issue of throwing warnings for missing arginfo in bundled files.
* Tests not fixed, because syntax of phpunit (<7 vs >9.3) are not compatible.
* In next release, needs to drop php5 and php7.0 support (in order to use phpunit > 7)
2020-08-11 19:30:46 -07:00
Peter Newman
e2cc2de304
Fix lots of spelling errors (#7751)
* Fix a typo

* Fix lots of spelling errors

* Fix a few more spelling mistakes

* s/parsable/parseable/

* Don't touch the third party files

* Cloneable is the preferred C# term

* Copyable is the preferred C++ term

* Revert "s/parsable/parseable/"

This reverts commit 534ecf7675.

* Revert unparseable->unparsable corrections
2020-08-10 11:08:25 -07:00
Joshua Haberman
610bbd0b95 Fixed compile_extension.sh --release to actually enable optimization. (#7766) 2020-08-07 14:44:49 -07:00
Paul Yang
0929596575 Check realoneof in json parsing (#7763)
* Check realoneof in json parsing

* Fix whichoneof to also work for synthetic oneof
2020-08-07 14:44:49 -07:00
Adam Cozzette
1c587a8059 Updated version to 3.13.0-rc2 2020-08-07 14:44:49 -07:00
Paul Yang
69c4bc5674 Updated upb to pick up several bugfixes (#7740)
* Updated upb to pick up several bugfixes. This fixes most conformance failures.

* Updated golden file, now that we are serializing as packed by default.

* Set "packed" properly: it is on by default for packable fields in proto3.

* Updated failure list for PHP now that we properly respect "packed".

* Temporarily disable encode_decode_test

Co-authored-by: Joshua Haberman <jhaberman@gmail.com>
2020-08-07 14:44:49 -07:00
Joshua Haberman
a28af654fa Removed obsolete TSRMLS_* usage. (#7731) 2020-08-07 14:44:49 -07:00
Joshua Haberman
5f32d484c1 Updated minimum required version for C extension to 7.0. (#7730) 2020-08-07 14:44:49 -07:00
Joshua Haberman
ad5a215359 Added proto3 presence support for PHP (#7724)
* WIP.

* Added proto3 presence support for PHP.

* Added compatibility code for old generated code.
2020-08-07 14:44:49 -07:00
Adam Cozzette
8940150706 Updated version to 3.13.0-rc1. 2020-08-07 14:44:49 -07:00
Joshua Haberman
ffb2b53834
Remove old PHP extension (#7695)
* Removed references to legacy class names from generated code.

* Removed old PHP extension in favor of new extension. This drops PHP5 compat.

* Updated failure lists for things fixed by the new extension.

* Updated Makefile.am for new file list.

* Fix distcheck.
2020-07-09 11:06:24 -07:00
David Grayston
c02ded7a57
Fix GPBUtil::getFullClassName() argument order (#7629) 2020-07-07 13:37:46 -07:00
Joshua Haberman
aaf84cb10f
Bugfix for when message constructor has no argument. (#7660)
This fixes the user issue: https://github.com/protocolbuffers/protobuf/issues/7611#issuecomment-647025031
2020-06-29 10:31:20 -07:00
Joshua Haberman
093faebcdb
New PHP C Extension based on upb_msg (#7614)
* Added code for the new PHP extension.

* Removed a bunch of unused variables shown by compiler warnings.

* Test protobuf2 in the tests.

* Updated upb version to fix a goldenfile test.

* Added pure-PHP changes. Extension now passes all tests.

* Enabled protobuf2 for all C extension tests.

* Fixed pure=PHP lib: full names no longer start with '.'.

* Added files for new extension to Makefile.am.

* Downgraded make-preload.py to python 2, since python3 isn't available in the php_all Kokoro image.

* Disable tests of new C extension with PHP 5.x.

* Also do not compile the extension for PHP5.

* Accept version 5.*.*, and use /usr/bin/python.

* Addressed PR comments.

* Addressed PR comments.

* Added "const" to a parameter and fixed a memory leak seen in Valgrind.

* Stop testing the C extension for PHP5.

The next release of protobuf will deprecate the C extension
for PHP5, see:
https://github.com/protocolbuffers/protobuf/issues/7525

* Made the PHP5.6 Mac test only exercise pure-PHP.

* Build protoc for PHP 5.6 test.

* Rewrote bundling script in PHP to avoid dependency on Python.

* A few more fixes.

* Fixed int32/int64 behavior for 32-bit builds.

* Match more PHP versions in testing script.

* Use phpize --clean before building extension.

* Force-delete configure.in to avoid phpize problems cross-version.

* Delete both configure.ac and configure.in.
2020-06-25 12:21:01 -07:00
Martin Landsem
dd8f748c3d
Changed parameter type from long to integer
PHP does not have a long type, and IDEs don't necessarily understand that long is the same as integer. 
E.g. PhpStorm will give an error like this: `Expected parameter of type '\Google\Protobuf\Internal\long', 'int' provided`
2020-06-10 22:53:56 +02:00
Joshua Haberman
f1ce8663ac
De-duplicated code to generate PHP protos and install phpunit. (#7605)
* De-duplicated code to generate PHP protos and install phpunit.

* Removed all references to generate_php_test_proto.

* Replaced with internal_build_cpp.

* Make Timestamp::__construct() static to avoid conflicts with MongoDB.

* Replicated PHPUnit versions and added new script to Makefile.am.

* Fixed filename in Makefile.am.

* Disabled test that SEGV's on macOS.

* Removed extraneous "set -e".

* Make sure generate_protos.sh happens on every test path.

* Removed stray '$' chars.

* Added proper support for aggregate_metadata tests. But now I get a stack overflow.

Stack overflow:
/Users/haberman/code/protobuf/php/tests/generated/GPBMetadata/Proto/TestDescriptors.php:16
/Users/haberman/code/protobuf/php/tests/generated/GPBMetadata/Proto/TestDescriptors.php:16
/Users/haberman/code/protobuf/php/tests/generated/GPBMetadata/Proto/TestDescriptors.php:16
/Users/haberman/code/protobuf/php/tests/generated/GPBMetadata/Proto/TestDescriptors.php:16
/Users/haberman/code/protobuf/php/tests/generated/GPBMetadata/Proto/TestDescriptors.php:16
/Users/haberman/code/protobuf/php/tests/generated/GPBMetadata/Proto/TestDescriptors.php:16
/Users/haberman/code/protobuf/php/tests/generated/GPBMetadata/Proto/TestDescriptors.php:16
/Users/haberman/code/protobuf/php/tests/generated/GPBMetadata/Proto/TestDescriptors.php:16

namespace GPBMetadata\Proto;

class TestDescriptors
{
    public static $is_initialized = false;

    public static function initOnce() {
        $pool = \Google\Protobuf\Internal\DescriptorPool::getGeneratedPool();
        if (static::$is_initialized == true) {
          return;
        }
        \GPBMetadata\Proto\TestDescriptors::initOnce();
        $pool->internalAddGeneratedFile(hex2bin(
            ""
        ), true);
        static::$is_initialized = true;
    }
}

* Fixed and verified metadata aggregation testing.
2020-06-09 15:40:29 -07:00
Joshua Haberman
b971243fe0 Merge branch '3.12.x' into merge-release-branch 2020-06-02 13:24:30 -07:00
Joshua Haberman
9ce8c330e7
Updated version to 3.12.3 and updated CHANGES.txt. (#7580)
* Updated version to 3.12.3 and updated CHANGES.txt.

* Re-ran generate_descriptor_protos.sh and made it more parallel.
2020-06-01 13:36:50 -07:00
Joshua Haberman
2cc68efd56
Simplified PHP testing scripts. (#7574)
* Simplified PHP testing scripts.

- allow them to be run from any directory.
- remove "VERSION" arg, we can get PHP from $PATH.

* Added a few places I missed.

* Removed redundant "cd `dirname $0`".

Also replaced all backticks with $(), for consistency.
2020-05-28 19:24:08 -07:00
Joshua Haberman
1688ea8d60
PHP: use php-config instead of explicitly setting include paths. (#7572) 2020-05-28 12:10:53 -07:00
Joshua Haberman
beeb621f50
Update protobuf version (#7557) 2020-05-26 15:46:39 -07:00
Joshua Haberman
746c46ed9d
Switch to using git@ for clone, to avoid having to enter password. (#7556) 2020-05-26 13:48:47 -07:00
Joshua Haberman
6ad138d85a
Update protobuf version (#7535) 2020-05-20 10:54:29 -07:00
Joshua Haberman
e90b71cdee Update protobuf version 2020-05-15 13:28:07 -07:00
Joshua Haberman
f597a24627 Update protobuf version 2020-05-12 12:49:46 -07:00
Paul Yang
d001f8cee4
Ignore unknown enum value when ignore_unknown specified (#7455) (#7462) 2020-05-05 18:12:27 -07:00
Joshua Haberman
a9f11d7d64
Updated version to 3.12.0-rc1. (#7449) 2020-04-30 15:34:10 -07:00
Joshua Haberman
74ad62759e Sync from Piper @306496510
PROTOBUF_SYNC_PIPER
2020-04-14 12:55:41 -07:00
Joshua Haberman
c649397029
Set execute bit on files if and only if they begin with (#!). (#7347)
* Set execute bit on files if and only if they begin with (#!).

Git only tracks the 'x' (executable) bit on each file. Prior to this
CL, our files were a random mix of executable and non-executable.
This change imposes some order by making files executable if and only
if they have shebang (#!) lines at the beginning.

We don't have any executable binaries checked into the repo, so
we shouldn't need to worry about that case.

* Added fix_permissions.sh script to set +x iff a file begins with (#!).
2020-04-01 15:28:25 -07:00
Joshua Haberman
9c676d83ea Regenerated protos with ./generate_descriptor_proto.sh 2020-03-31 16:35:09 -07:00
Rafi Kamal
0eb476b696 Merge branch 3.11.x to master 2020-02-18 16:42:47 -08:00
Rafi Kamal
c74057267d
Update protobuf version (#7206) 2020-02-12 14:41:16 -08:00
Paul Yang
537c5aa9e0
Aggregate Metadata Files (#7155) (#7194)
Instead of calling initOnce of dependencies, initialize metadata of dependencies in the same file.

Needs to pass aggregate_metadata option to protoc to trigger, e.g.:
--php_out=aggregate_metadata=foo#bar:generated_dir
For each input file, transitive dependencies (including itself), whose package name has the prefix of foo or bar, will be aggregated, in which their metadata string will be aggregated in the same internalAddGeneratedFile call. For other dependencies, initOnce is called as before.

This feature is EXPERIMENTAL. DO NOT USE!!!
2020-02-11 15:44:40 -08:00
Paul Yang
ac70b7cfb7
Aggregate Metadata Files (#7155)
Instead of calling initOnce of dependencies, initialize metadata of dependencies in the same file.

Needs to pass aggregate_metadata option to protoc to trigger, e.g.:
--php_out=aggregate_metadata=foo#bar:generated_dir
For each input file, transitive dependencies (including itself), whose package name has the prefix of foo or bar, will be aggregated, in which their metadata string will be aggregated in the same internalAddGeneratedFile call. For other dependencies, initOnce is called as before.

This feature is EXPERIMENTAL. DO NOT USE!!!
2020-02-10 11:27:27 -08:00
Rafi Kamal
345df38dd3
Update protobuf version (#7143) 2020-01-31 13:47:09 -08:00
Luca Santarella
c5eada8eeb
Refactored ulong to zend_ulong for php7.4 compatibility (#7147) 2020-01-30 16:47:32 -08:00
Paul Yang
e8016753e3
Maven requires https connection (#7110) (#7114) 2020-01-22 12:29:56 -08:00
Paul Yang
629ca244a1
Call register_class before getClass from desc (#7077)
* Call register_class before getClass from desc

* Remove debug code
2020-01-21 15:38:42 -08:00
Paul Yang
39f4240856
Maven requires https connection (#7110) 2020-01-20 19:23:06 -08:00
Andres Valdes
35febfc2e9 Correct @return in Any.unpack docblock (#7089)
As per https://docs.phpdoc.org/latest/references/phpdoc/tags/return.html, the first token after the @return tag should be the return type.
2020-01-20 16:32:11 -08:00
Rafi Kamal
ed8688de72
Merge pull request #7064 from rafi-kamal/3.11.x-202001071136
Merge branch 3.11.x to master
2020-01-08 12:24:20 -08:00
Brian Wignall
a104dffcb6 Fix typos (#7050)
Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos, with https://github.com/bwignall/typochecker to help automate the checking.
2020-01-08 10:18:20 -08:00
Paul Yang
fe1790ca0d
Fix Multiple Request for PHP (#7008)
* Add scripts to test multirequest

* chmod ug+x multirequest.sh

* Add continuous test

* Compile c extension

* Class entry is obsolete in the second request
1) Needes to use class name in persistent map
2) Invalidate class entry stored in descriptor

* Add new files to dist

* Fix compile_extension

* Cleanup outputs for phpize
2019-12-12 13:59:51 -08:00
Rafi Kamal
39492b68d8
Update protobuf version to 3.11.2 (#7004) 2019-12-10 17:50:28 -08:00
Paul Yang
a66423f0fd
Make c extension portable for php 7.4 (#6968)
* Make c extension portable for php 7.4

* Fix conformance tests

* Fix comments

* Fix 32-bit

* Update conformance failure list

* Fix compiler warnings

* Cleanup configure created by phpize
The file created in php 7.4 is not recognizable by previous versions

* Fix conformance tests for 64-bit php

* Fix conformance test

* Fix compile warning

* Fix compile warnings
2019-12-09 17:02:10 -08:00
Paul Yang
2929bb3736
Initialize wrapper message during parsing (#6974)
* Initialize wrapper message during parsing
In case the internal value is default

* Fix zts build
2019-12-03 11:11:28 -08:00
Rafi Kamal
b78c53f935
Update protobuf version to 3.11.1 (#6972) 2019-12-02 11:57:21 -08:00
Paul Yang
e69c939652
Extern declare protobuf_globals (#6946) 2019-11-27 01:00:51 -08:00
Rafi Kamal
1d5375c621
Update protobuf version to 3.11.0 (#6943) 2019-11-25 15:12:00 -08:00
Rafi Kamal
b0386daa19
Remove add_proto_enumdesc and get_proto_enumdesc (#6931) 2019-11-22 11:40:56 -08:00
Rafi Kamal
391440e3dd
Implement lazy loading of php class for proto messages (#6911) (#6925)
* Implement lazy loading of php class for proto messages

* Fix php 7.1

* Fix encode

* Fix memory leak

* Fix enum descriptor
2019-11-22 10:06:45 -08:00
Bo Yang
dbd66dddfb Remove add_proto_enumdesc and get_proto_enumdesc 2019-11-22 06:55:05 +00:00
Rafi Kamal
6220db4ec4
Update protobuf version (#6927) 2019-11-21 19:10:04 -08:00
Paul Yang
6d7bb7e714
Implement lazy loading of php class for proto messages (#6911)
* Implement lazy loading of php class for proto messages

* Fix php 7.1

* Fix encode

* Fix memory leak

* Fix enum descriptor
2019-11-20 20:33:27 -08:00
Paul Yang
edda0c92f5 Persistent Descriptor Pool (#6899)
* 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
2019-11-19 15:32:13 -08:00
Rafi Kamal
cd7b27be38 Update protobuf version (#6898) 2019-11-19 15:32:13 -08:00
Paul Yang
3cae867740
Persistent Descriptor Pool (#6899)
* 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
2019-11-18 13:13:25 -08:00
Rafi Kamal
3cc55d6167
Update protobuf version (#6898) 2019-11-15 17:44:10 -08:00
Paul Yang
601f6963eb
Lazily Create Singular Wrapper Message (#6833)
* 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
2019-11-14 12:17:04 -08:00
Paul Yang
c53e5b8e11
Avoid too much overhead in layout_init (#6716)
* 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
2019-10-29 12:48:24 -07:00
Rafi Kamal
d8e678aae4
Merge pull request #6728 from protocolbuffers/3.10.x-merge
Merge 3.10.x with master and increment the version number
2019-10-10 16:56:19 -07:00
Paul Yang
2dec82e1e0
Fix conformance test (#6750)
* Fix conformance test

Default value of string/message map is not encoded

* Fix zts build
2019-10-10 16:03:52 -07:00
Rafi Kamal
2ed41359fe Update version to 3.11.0-RC0 2019-10-03 14:24:27 -07:00
Rafi Kamal
97c7c3fc97 Merge 3.10.x to master 2019-10-03 14:03:38 -07:00
Paul Yang
f50204dab4
Initialize well known type values (#6713) (#6714)
* Initialize well known type values

Also fixes #6667

* Revert unwanted change
2019-09-30 15:53:30 -07:00
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