Commit Graph

436 Commits

Author SHA1 Message Date
Adam Cozzette
f3192d6128 Update protobuf version 2020-11-13 11:27:32 -08:00
Adam Cozzette
1b851b3fe6 Update protobuf version 2020-11-12 12:44:26 -08:00
Adam Cozzette
31f719618c Added back in notes field in package.xml
This field turns out to be required and cannot be empty, so this commit
adds some placeholder text.
2020-11-11 10:47:39 -08:00
Adam Cozzette
a8ab1fade9 Update protobuf version 2020-11-10 17:15:32 -08:00
Adam Cozzette
42d0c53f5b Fixed PHP version and release notes
This commit updates protobuf.c to refer to the PHP version macro so that
it stays up to date. I also deleted the notes element near the top of
package.xml. This seems to be a global notes field rather than a
per-release field, so it was showing up on new releases where it doesn't
make sense.

Fixes #8017.
2020-11-10 16:24:49 -08:00
Joshua Haberman
6ef18e357a
[PHP] Fixes for package.xml: added/removed source files. (#8022)
These files should have been added/removed in
https://github.com/protocolbuffers/protobuf/pull/7944, but
this was missed and Kokoro does not test "pear package".
2020-11-10 11:34:16 -08:00
Adam Cozzette
27100b40fd Update protobuf version 2020-11-05 14:30:53 -08:00
Joshua Haberman
a8a1493f35 Moved HasOneof test into GeneratedClassTest.php, to avoid the extra file. 2020-11-04 11:32:43 -08:00
Joshua Haberman
957a0bf08c
Merge pull request #8003 from anight/php_extension_add_has_oneof_field_method
add missing hasOneof method to check presence of oneof fields
2020-11-04 11:30:02 -08:00
Andrei Nigmatulin
52d3be3276 added tests for hasOneof<Field>() php methods 2020-11-03 12:17:25 +00:00
Joshua Haberman
314ce3c8a0 PHP: Fix in upb for 32-bit platforms. 2020-11-02 21:46:37 -08:00
Andrei Nigmatulin
913e1ede12 add missing has<Field>() method for oneof fields 2020-11-03 00:54:13 +00:00
Joshua Haberman
78f56b84b5 Set -std=gnu99 for PHP extension compile. 2020-11-02 10:26:47 -08:00
Joshua Haberman
f65bcca31d Added extra files to Makefile.am and fixed spelling errors. 2020-11-02 09:44:46 -08:00
Joshua Haberman
a6985e598c New version of upb, and a new hash function wyhash in third_party. 2020-11-02 08:09:11 -08:00
Joshua Haberman
510cdff1f0 Merge branch 'master' into php-wkt 2020-10-22 15:53:02 -07:00
Paul Yang
0a648daaca
Use the https address for git clone (#7951)
The previous git address failed for no access
2020-10-08 14:56:27 -07:00
Bo Yang
37e69bcddf Merge branch '3.13.x' 2020-10-08 13:32:41 -07:00
Paul Yang
d1eca4e4b4
Update version number to 3.13.0.1 for php (#7950) 2020-10-08 11:17:30 -07:00
Joshua Haberman
8308aa0c31 Properly terminate method array. 2020-10-06 14:18:21 -07:00
Joshua Haberman
5a98ff98d7 Create a separate InternalDescriptorPool method to see if that fixes preloading. 2020-10-06 10:57:33 -07:00
Joshua Haberman
e62cf76b94 Added missing base classes. 2020-10-05 22:50:15 -07:00
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