Commit Graph

564 Commits

Author SHA1 Message Date
Brent Shaffer
2126123b53
PHP: add new keywords to missing test (#8801) 2021-07-08 12:54:08 -07:00
Brent Shaffer
d2c82dff39
fix: missing comma in PHP names.c and generator.cc (#8787)
* Update names.c

* Update php_generator.cc
2021-07-07 13:02:34 -07:00
Brent Shaffer
d995c1c182 update counts 2021-06-29 09:17:25 -07:00
Brent Shaffer
bade043986 update reserved names: add finally, fn, match, yield 2021-06-29 07:56:08 -07:00
Paul Yang
b24d0c2b7a
Disable the warning for adding duplicated symbol (#8720)
When we need to aggregate metadata, duplication does happen.
Disable the warning for now to mitigate the noise for users of aggregate
metadata.
2021-06-09 15:09:27 -07:00
Deanna Garcia
367851d124 Update protobuf version 2021-06-04 21:21:39 +00:00
deannagarcia
f5a0e3988b
Merge branch 'master' into 3.17.x 2021-06-04 17:22:24 +00:00
Deanna Garcia
506f2273d1 Merging 3.17.x branch into master 2021-06-02 22:29:40 +00:00
Joshua Haberman
75de6aa21a Fixed sub-message getters for well-known types when message is unset.
The well-known types generate C code into wkt.inc, and this C code was
not testing isset($msg->submsg_field) like the generated code does:

```php
// PHP generated getter: checks isset().
public function getOptions()
{
    return isset($this->options) ? $this->options : null;
}
```

```c
// C generated getter, does not check upb_msg_has()
static PHP_METHOD(google_protobuf_Value, getListValue) {
  Message* intern = (Message*)Z_OBJ_P(getThis());
  const upb_fielddef *f = upb_msgdef_ntofz(intern->desc->msgdef,
                                           "list_value");
  zval ret;
  Message_get(intern, f, &ret);
  RETURN_COPY_VALUE(&ret);
}
```

This led to an error where we wnuld try to get a sub-message field from upb
when it `upb_msg_has(msg, field) == false`, which is an error according to upb.

There are two possible fixes for this bug. A guiding principle is that we want
the generated C code in wkt.inc to have the same behavior as PHP generated
code. Following this principle, the two possible fixes are:

1. Change the code generator for wkt.inc to check upb_msg_has(f) before
   calling Message_get(). This would match the isset() check that the
   The PHP generated code does, and we would leave the PHP code unchanged.

2. Change Message_get() to itself perform the upb_msg_has(f) check for
   sub-message fields. This means that generated code would no longer need
   to perform an isset() check, so we would want to remove this check from
   the PHP generated code also to avoid a redundant check.

Both of these are reasonable fixes, and it is not immediately obvious which is
better. (1) has the benefit of resolving this case when we are in more
specialized code (a getter function that already knows this is a sub-message
field), and therefore avoids performing the check later in more generic code
that would have to test the type again. On the other hand, the isset() check is
not needed for the pure PHP implementation, as an unset PHP variable will
return `null` anyway. And for the C extension, we'd rather check upb_msg_has()
at the C level instead of PHP.

So this change implements (2). The generated code in wkt.inc remains unchanged,
and the PHP generated code for sub-message fields is changed to remove the
isset() check.
2021-05-27 10:45:18 -07:00
Deanna Garcia
d303bba1bb Updating change logs 2021-05-25 21:02:52 +00:00
Deanna Garcia
5b8208ecea Update protobuf version 2021-05-25 19:36:05 +00:00
Joshua Haberman
9521803d40 Sync from Piper @375548932
PROTOBUF_SYNC_PIPER
2021-05-24 13:49:39 -07:00
Adam Cozzette
b506c31de0 Merge branch '3.17.x' into merge-3.17.x 2021-05-24 12:24:38 -07:00
Joshua Haberman
e635605003
Added missing release notes for 3.17.1. (#8649) 2021-05-24 11:15:46 -07:00
Adam Cozzette
52784ced2f
Update protobuf version (#8633) 2021-05-19 16:43:44 -07:00
Joshua Haberman
0b87475592
Php & Ruby Cherry Picks for 3.17.1 (#8632)
* Some more updates to PHP testing infrastructure (#8576)

* WIP.

* Added build config for all of the tests.

* Use ../src/protoc if it is available, for cases where Bazel isn't available.

* Added test_php.sh.

* Fix for the broken macOS tests.

* Move all jobs to use php80 instead of lots of separate jobs.

* Only pass -t flag if we are running in a terminal.

* Updated php_all job to use new Docker stuff.

* Fixed PHP memory leaks and arginfo errors (#8614)

* Fixed a bunch of incorrect arginfo and a few incorrect error messages.

* Passes mem check test with no leaks!

* WIP.

* Fix build warning that was causing Bazel build to fail.

* Added compatibility code for PHP <8.0.

* Added test_valgrind target and made tests Valgrind-clean.

* Updated Valgrind test to fail if memory leaks are detected.

* Removed intermediate shell script so commands are easier to cut, paste, and modify.

* Passing all Valgrind tests!

* Hoist addref into ObjCache_Get().

* Removed special case of map descriptors by keying object map on upb_msgdef.

* Removed all remaining RETURN_ZVAL() macros.

* Removed all explicit reference add/del operations.

* Added REFCOUNTING.md to Makefile.am.

* Updated upb version and fixed PHP to not get unset message field. (#8621)

* Updated upb version and fixed PHP to not get unset message field.

* Updated changelog.

* Fixed preproc test to handle old versions of Clang withot __has_attribute().

* A second try at fixing __has_attribute().

* Copy __has_attribute() fix to cc file also.

* Updated failure list for PHP for fixed test.

* Updated version of upb for Ruby (#8624)

* Updated upb.

* Preserve legacy behavior for unset messages.

* Updated failure list.

* Updated CHANGES.txt.

* Added erroneously-deleted test file.

* Fixed condition on compatibility code.

* Re-introduced deleted file again, and fixed Rakefile to not delete it.

* Fix generation of test protos.
2021-05-19 15:53:47 -07:00
Joshua Haberman
7611164792
Updated upb version and fixed PHP to not get unset message field. (#8621)
* Updated upb version and fixed PHP to not get unset message field.

* Updated changelog.

* Fixed preproc test to handle old versions of Clang withot __has_attribute().

* A second try at fixing __has_attribute().

* Copy __has_attribute() fix to cc file also.

* Updated failure list for PHP for fixed test.
2021-05-17 15:27:05 -07:00
Joshua Haberman
7e95c64dfb
[PHP] Fixed $msg->setMessage(null) to properly clear the message. (#8472)
* [PHP] Fixed $msg->setMessage(null) to properly clear the message.

Fixes: https://github.com/protocolbuffers/protobuf/issues/8457

* Changed pure PHP to throw TypeError, and added a test for null.

* Added more tests and fixed null in setter for oneof.
2021-05-14 16:48:45 -07:00
Deanna Garcia
380e352b0b Sync from Piper @373820256
PROTOBUF_SYNC_PIPER
2021-05-14 17:50:31 +00:00
Joshua Haberman
b0d90e3abe
Fixed PHP memory leaks and arginfo errors (#8614)
* Fixed a bunch of incorrect arginfo and a few incorrect error messages.

* Passes mem check test with no leaks!

* WIP.

* Fix build warning that was causing Bazel build to fail.

* Added compatibility code for PHP <8.0.

* Added test_valgrind target and made tests Valgrind-clean.

* Updated Valgrind test to fail if memory leaks are detected.

* Removed intermediate shell script so commands are easier to cut, paste, and modify.

* Passing all Valgrind tests!

* Hoist addref into ObjCache_Get().

* Removed special case of map descriptors by keying object map on upb_msgdef.

* Removed all remaining RETURN_ZVAL() macros.

* Removed all explicit reference add/del operations.

* Added REFCOUNTING.md to Makefile.am.
2021-05-13 23:16:49 -07:00
Adam Cozzette
7bbfd14b7f
Merge pull request #8603 from acozzette/merge-3.17.x
Merge 3.17.x into master
2021-05-13 08:59:12 -07:00
Adam Cozzette
086aa97385 Merge branch '3.17.x' into merge-3.17.x 2021-05-12 16:26:13 -07:00
Adam Cozzette
652d99a8ee
Update protobuf version (#8606) 2021-05-12 16:20:18 -07:00
Joshua Haberman
45e9707871
Some more updates to PHP testing infrastructure (#8576)
* WIP.

* Added build config for all of the tests.

* Use ../src/protoc if it is available, for cases where Bazel isn't available.

* Added test_php.sh.

* Fix for the broken macOS tests.

* Move all jobs to use php80 instead of lots of separate jobs.

* Only pass -t flag if we are running in a terminal.

* Updated php_all job to use new Docker stuff.
2021-05-12 10:42:16 -07:00
Adam Cozzette
3133828c7f Merge branch '3.17.x' into merge-3.17.x 2021-05-11 10:50:07 -07:00
Adam Cozzette
f807c02226
Update protobuf version to 3.17.0-rc2 (#8586)
* Update protobuf version

* Updated Kotlin versions and updated script to handle them
2021-05-10 15:31:35 -07:00
Adam Cozzette
e211ad3300
Updated CHANGES.txt and PHP changelog for 3.17.0 (#8583) 2021-05-07 11:34:04 -07:00
Adam Cozzette
540852f4c6 Merge branch '3.17.x' into merge-3-17-x 2021-05-07 11:05:18 -07:00
Adam Cozzette
7025f37cde
Update protobuf version (#8575) 2021-05-07 09:51:15 -07:00
Adam Cozzette
d0c4c409ef Merge branch '3.16.x' into merge-3-16-x 2021-05-07 09:36:06 -07:00
Adam Cozzette
2dc747c574
Update PHP release notes and update version to 3.16.0 (#8573)
* Updated PHP release notes in packages.xml

* Update protobuf version to 3.16.0
2021-05-06 12:50:11 -07:00
Adam Cozzette
debc03dfc5
Update protobuf version to 3.16.0-rc2 (#8556)
* Update CHANGES.txt

* Update protobuf version
2021-05-05 13:25:54 -07:00
Joshua Haberman
8b87075924
Updated and simplified PHP testing structure (#8558)
* Simplified PHP testing setup.

- Consolidated on a single autoloader, created by composer.
- Consolidated on a single phpunit invocation strategy: we run
  phpunit on a directory, which will run all tests matching *Test.php
  in that directory.
- We now rely on autoloading to import all test protos. require_once()
  calls for test protos are removed.
- For now the valgrind tests are removed. A follow-up PR will re-enable
  them in a more robust way.

* More improvements to PHP testing.

1. Replace custom PHPUnit-selection logic in test.sh with generic
   composer version selection.
2. Optimized both test proto generation and the custom extension
   build to avoid unnecessary work when the files are already up
   to date.

* Added assertions to verify that the C test doesn't use PHP sources.

* Updated tests.sh for the new PHP testing commands.

* Removed obsolete rules from tests.sh.

* Fixed generate_test_protos.sh for when tmp does not exist.

Also removed undefined_test.php and fixed Makefile.am.

* Added php8.0_all again which is still used.

* Added missing file to Makefile.am.

* Re-added php_all_32 rule which is also still used.

* Updated testing commands for macOS and download composer.

* Use /usr/local/bin on mac instead of /usr/bin, since the latter is not writable.
2021-05-04 10:19:22 -07:00
Paul Yang
114efc42d4
Fix php json parsing not throwing error for unknown field. (#8528) 2021-05-04 10:09:56 -07:00
Joshua Haberman
ce560630bf Sync from Piper @368734211
PROTOBUF_SYNC_PIPER
2021-04-15 15:53:17 -07:00
Adam Cozzette
5679811239 Merge branch '3.15.x' into merge-3-15-x 2021-04-08 10:54:02 -07:00
Adam Cozzette
436bd7880e
Updated version to 3.15.8 (#8463)
* Update protobuf version

* Updated CHANGES.txt and package.xml for 3.15.8
2021-04-07 15:38:38 -07:00
Adam Cozzette
7689f00ba8
Update protobuf version (#8448) 2021-04-06 14:26:56 -07:00
Adam Cozzette
87aa9adb86 Merge branch 'master' into 3.15.x 2021-04-02 14:55:02 -07:00
Adam Cozzette
878be3569e Update protobuf version 2021-04-02 11:06:56 -07:00
Adam Cozzette
c00c2d43bb Updated CHANGES.txt and package.xml with changes for 3.15.7 2021-04-02 11:06:56 -07:00
Derek Perez
4008d229aa Sync from Piper @366297034
PROTOBUF_SYNC_PIPER
2021-04-01 18:49:52 +00:00
Joshua Haberman
96307d28f6 Sync from Piper @364389596
PROTOBUF_SYNC_PIPER
2021-03-22 13:05:55 -07:00
Adam Cozzette
6aa539bf01 Update protobuf version 2021-03-10 14:53:26 -08:00
Adam Cozzette
971a5935ed Updated CHANGES.txt and PHP changelog for 3.15.6 2021-03-10 14:53:26 -08:00
Adam Cozzette
4fff47a418 Update protobuf version 2021-03-04 13:35:04 -08:00
Adam Cozzette
5702d51ec0 Updated CHANGES.txt and PHP release notes for 3.15.5 2021-03-04 13:35:04 -08:00
Joshua Haberman
9b5e357df5 Fixed quadratic memory use in array append for PHP and Ruby. 2021-03-04 09:12:29 -08:00
Adam Cozzette
fd8aabf32d Update protobuf version 2021-03-03 11:37:48 -08:00
Adam Cozzette
e5c067f81b Updated CHANGES.txt and PHP changelog for 3.15.4 release 2021-03-03 11:37:48 -08:00
Antony Dovgal
aa41d9005b read_property() handler is not supposed to return NULL
NULL is never expected as a result of read_property() handler,
it should return &EG(uninitialized_zval) if there is no such property in
the object
2021-03-03 11:32:58 -08:00
Joshua Haberman
9df42757f9 Sync from Piper @359788468
PROTOBUF_SYNC_PIPER
2021-02-26 10:37:37 -08:00
Adam Cozzette
983d115bd9 Update protobuf version 2021-02-25 09:20:20 -08:00
Adam Cozzette
d8254a67ce Merge branch '3.15.x' into 3.15.x-202102231541 2021-02-23 15:51:34 -08:00
Adam Cozzette
d7e943b8d2 Update protobuf version 2021-02-23 13:21:42 -08:00
Adam Cozzette
6e84adc9ff Merge branch '3.15.x' into merge-3-15-x 2021-02-22 11:03:32 -08:00
Adam Cozzette
052dc799d2 Update protobuf version 2021-02-19 15:12:24 -08:00
Adam Cozzette
133e5e7526 Update protobuf version 2021-02-18 16:53:24 -08:00
Adam Cozzette
de701c660b Update protobuf version 2021-02-18 16:53:24 -08:00
Joshua Haberman
a94870872c Added more information to "file already loaded" warning.
Also changed it to zend_error() so it is more easily suppressed.
2021-02-18 16:53:24 -08:00
Adam Cozzette
76bfd89090 Added PHP changes for 3.15.0 into package.xml 2021-02-18 16:53:24 -08:00
Adam Cozzette
ac9218c5d9 Update protobuf version 2021-02-18 16:53:24 -08:00
Adam Cozzette
ae50d9b990 Update protobuf version 2021-02-18 11:50:15 -08:00
Adam Cozzette
8260126500 Update protobuf version 2021-02-17 10:51:33 -08:00
Joshua Haberman
2653fc807a
Merge pull request #7613 from landsem/patch-1
[PHP] Changed parameter type from long to integer
2021-02-17 10:47:38 -08:00
Joshua Haberman
5e79c737d8
Merge pull request #8236 from bshaffer/patch-3
fix: README supported PHP version for C extension
2021-02-17 10:22:32 -08:00
Joshua Haberman
db66c95eaf Added more information to "file already loaded" warning.
Also changed it to zend_error() so it is more easily suppressed.
2021-02-09 17:44:30 -08:00
Adam Cozzette
66e5185780 Added PHP changes for 3.15.0 into package.xml 2021-02-09 14:20:19 -08:00
Adam Cozzette
e9f2ef308c Update protobuf version 2021-02-05 15:37:10 -08:00
Joshua Haberman
51daaba638 Sync from Piper @355707933
PROTOBUF_SYNC_PIPER
2021-02-04 14:09:49 -08:00
Brent Shaffer
e75f552587
Update README.md 2021-02-02 09:47:48 -08:00
Brent Shaffer
bd08f75586
fix: README supported PHP version for C extension 2021-01-27 11:31:54 -07:00
Joshua Haberman
d5079ed7db
Fixed PHP to support field numbers >=2**28. (#8235) 2021-01-27 10:12:59 -08:00
Brent Shaffer
468bc193ec
fix: convert native PHP floats to single precision (#8187)
* fix: convert native PHP floats to single precision

* fix unpack
2021-01-11 11:53:35 -08:00
Joshua Haberman
7089ff0ef2
Fix PhpDoc comments for message accessors to include "|null". (#8136)
Message accessors will return null when when the field is not
set, so this should be reflected in the PhpDoc.

Also updated the code generator for the well-known types to reflect
the edits made in https://github.com/protocolbuffers/protobuf/pull/8105.

Also explicitly check for upb_msg_has() in the oneof accessor, so
we are not implicitly relying on unset message fields returning NULL
at the upb level.
2021-01-07 14:58:38 -08:00
Paul Yang
823f351448
Port for php8 (#8105)
* Port for php8

* Port php c extension for php8

* Update composer.json

* Drop php7.0 support

* Update phpunit for php7.1 in c extension test

* Add back support for php7.0

* Add badge for php8 continuous build
2020-12-04 13:46:34 -08:00
Mike Lehan
9ee163a5d7
Update param type on offsetGet (#8033)
The param was typed as `object` which is invalid as when items are set in the container the key passes through `checkKey` where it enforces the key must be various classes of integer, bool or string. Thus I have replaced it with a union type (in future this can be a proper PHP level typehint, but for now only doctype)
2020-11-30 11:29:13 -08:00
Antony Dovgal
51b620ac96
unregister INI entries and fix invalid read on shutdown (#8042) 2020-11-25 11:02:35 -08:00
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