Commit Graph

461 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
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
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
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