diff options
Diffstat (limited to 'php')
-rw-r--r-- | php/ext/google/protobuf/package.xml | 20 | ||||
-rw-r--r-- | php/ext/google/protobuf/protobuf.h | 2 | ||||
-rw-r--r-- | php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php | 5 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php | 33 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/FieldOptions.php | 45 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/GPBUtil.php | 2 | ||||
-rw-r--r-- | php/src/Google/Protobuf/Internal/Message.php | 3 | ||||
-rw-r--r-- | php/tests/generated_class_test.php | 12 | ||||
-rw-r--r-- | php/tests/memory_leak_test.php | 2 | ||||
-rw-r--r-- | php/tests/proto/test.proto | 7 |
10 files changed, 106 insertions, 25 deletions
diff --git a/php/ext/google/protobuf/package.xml b/php/ext/google/protobuf/package.xml index 20a45bc6..2d318517 100644 --- a/php/ext/google/protobuf/package.xml +++ b/php/ext/google/protobuf/package.xml @@ -13,8 +13,8 @@ <date>2017-01-13</date> <time>16:06:07</time> <version> - <release>3.3.2</release> - <api>3.3.0</api> + <release>3.4.0</release> + <api>3.4.0</api> </version> <stability> <release>stable</release> @@ -136,5 +136,21 @@ GA release. GA release. </notes> </release> + <release> + <version> + <release>3.4.0</release> + <api>3.4.0</api> + </version> + <stability> + <release>stable</release> + <api>stable</api> + </stability> + <date>2017-08-16</date> + <time>15:33:07</time> + <license uri="https://opensource.org/licenses/BSD-3-Clause">3-Clause BSD License</license> + <notes> +GA release. + </notes> + </release> </changelog> </package> diff --git a/php/ext/google/protobuf/protobuf.h b/php/ext/google/protobuf/protobuf.h index f9e9d229..b2838e56 100644 --- a/php/ext/google/protobuf/protobuf.h +++ b/php/ext/google/protobuf/protobuf.h @@ -37,7 +37,7 @@ #include "upb.h" #define PHP_PROTOBUF_EXTNAME "protobuf" -#define PHP_PROTOBUF_VERSION "3.3.2" +#define PHP_PROTOBUF_VERSION "3.4.0" #define MAX_LENGTH_OF_INT64 20 #define SIZEOF_INT64 8 diff --git a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php index 1e3c745e..60722d00 100644 --- a/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php +++ b/php/src/GPBMetadata/Google/Protobuf/Internal/Descriptor.php @@ -49,6 +49,7 @@ class Descriptor $pool->addMessage('google.protobuf.internal.DescriptorProto.ExtensionRange', \Google\Protobuf\Internal\DescriptorProto_ExtensionRange::class) ->optional('start', \Google\Protobuf\Internal\GPBType::INT32, 1) ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2) + ->optional('options', \Google\Protobuf\Internal\GPBType::MESSAGE, 3, 'google.protobuf.internal.ExtensionRangeOptions') ->finalizeToPool(); $pool->addMessage('google.protobuf.internal.DescriptorProto.ReservedRange', \Google\Protobuf\Internal\DescriptorProto_ReservedRange::class) @@ -56,6 +57,10 @@ class Descriptor ->optional('end', \Google\Protobuf\Internal\GPBType::INT32, 2) ->finalizeToPool(); + $pool->addMessage('google.protobuf.internal.ExtensionRangeOptions', \Google\Protobuf\Internal\ExtensionRangeOptions::class) + ->repeated('uninterpreted_option', \Google\Protobuf\Internal\GPBType::MESSAGE, 999, 'google.protobuf.internal.UninterpretedOption') + ->finalizeToPool(); + $pool->addMessage('google.protobuf.internal.FieldDescriptorProto', \Google\Protobuf\Internal\FieldDescriptorProto::class) ->optional('name', \Google\Protobuf\Internal\GPBType::STRING, 1) ->optional('number', \Google\Protobuf\Internal\GPBType::INT32, 3) diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php index 51d5d359..1d455995 100644 --- a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php +++ b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php @@ -25,6 +25,11 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message */ private $end = 0; private $has_end = false; + /** + * Generated from protobuf field <code>optional .google.protobuf.ExtensionRangeOptions options = 3;</code> + */ + private $options = null; + private $has_options = false; public function __construct() { \GPBMetadata\Google\Protobuf\Internal\Descriptor::initOnce(); @@ -87,5 +92,33 @@ class DescriptorProto_ExtensionRange extends \Google\Protobuf\Internal\Message return $this->has_end; } + /** + * Generated from protobuf field <code>optional .google.protobuf.ExtensionRangeOptions options = 3;</code> + * @return \Google\Protobuf\Internal\ExtensionRangeOptions + */ + public function getOptions() + { + return $this->options; + } + + /** + * Generated from protobuf field <code>optional .google.protobuf.ExtensionRangeOptions options = 3;</code> + * @param \Google\Protobuf\Internal\ExtensionRangeOptions $var + * @return $this + */ + public function setOptions($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Internal\ExtensionRangeOptions::class); + $this->options = $var; + $this->has_options = true; + + return $this; + } + + public function hasOptions() + { + return $this->has_options; + } + } diff --git a/php/src/Google/Protobuf/Internal/FieldOptions.php b/php/src/Google/Protobuf/Internal/FieldOptions.php index 3144e670..169f860b 100644 --- a/php/src/Google/Protobuf/Internal/FieldOptions.php +++ b/php/src/Google/Protobuf/Internal/FieldOptions.php @@ -39,13 +39,14 @@ class FieldOptions extends \Google\Protobuf\Internal\Message /** * The jstype option determines the JavaScript type used for values of the * field. The option is permitted only for 64 bit integral and fixed types - * (int64, uint64, sint64, fixed64, sfixed64). By default these types are - * represented as JavaScript strings. This avoids loss of precision that can - * happen when a large value is converted to a floating point JavaScript - * numbers. Specifying JS_NUMBER for the jstype causes the generated - * JavaScript code to use the JavaScript "number" type instead of strings. - * This option is an enum to permit additional types to be added, - * e.g. goog.math.Integer. + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. * * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code> */ @@ -192,13 +193,14 @@ class FieldOptions extends \Google\Protobuf\Internal\Message /** * The jstype option determines the JavaScript type used for values of the * field. The option is permitted only for 64 bit integral and fixed types - * (int64, uint64, sint64, fixed64, sfixed64). By default these types are - * represented as JavaScript strings. This avoids loss of precision that can - * happen when a large value is converted to a floating point JavaScript - * numbers. Specifying JS_NUMBER for the jstype causes the generated - * JavaScript code to use the JavaScript "number" type instead of strings. - * This option is an enum to permit additional types to be added, - * e.g. goog.math.Integer. + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. * * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code> * @return int @@ -211,13 +213,14 @@ class FieldOptions extends \Google\Protobuf\Internal\Message /** * The jstype option determines the JavaScript type used for values of the * field. The option is permitted only for 64 bit integral and fixed types - * (int64, uint64, sint64, fixed64, sfixed64). By default these types are - * represented as JavaScript strings. This avoids loss of precision that can - * happen when a large value is converted to a floating point JavaScript - * numbers. Specifying JS_NUMBER for the jstype causes the generated - * JavaScript code to use the JavaScript "number" type instead of strings. - * This option is an enum to permit additional types to be added, - * e.g. goog.math.Integer. + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. * * Generated from protobuf field <code>optional .google.protobuf.FieldOptions.JSType jstype = 6 [default = JS_NORMAL];</code> * @param int $var diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php index 6fe36068..84e8ecf0 100644 --- a/php/src/Google/Protobuf/Internal/GPBUtil.php +++ b/php/src/Google/Protobuf/Internal/GPBUtil.php @@ -270,7 +270,7 @@ class GPBUtil $name, $file_proto) { - $classname = implode('_', array_map('ucwords', explode('.', $name))); + $classname = implode('_', explode('.', $name)); return static::getClassNamePrefix($classname, $file_proto) . $classname; } diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php index e1009f2f..8886e61a 100644 --- a/php/src/Google/Protobuf/Internal/Message.php +++ b/php/src/Google/Protobuf/Internal/Message.php @@ -76,6 +76,9 @@ class Message } $pool = DescriptorPool::getGeneratedPool(); $this->desc = $pool->getDescriptorByClassName(get_class($this)); + if (is_null($this->desc)) { + user_error(get_class($this) . "is not found in descriptor pool."); + } foreach ($this->desc->getField() as $field) { $setter = $field->getSetter(); if ($field->isMap()) { diff --git a/php/tests/generated_class_test.php b/php/tests/generated_class_test.php index 86e68683..98918bce 100644 --- a/php/tests/generated_class_test.php +++ b/php/tests/generated_class_test.php @@ -14,6 +14,8 @@ use Foo\TestIncludePrefixMessage; use Foo\TestMessage; use Foo\TestMessage_Sub; use Foo\TestReverseFieldOrder; +use Foo\testLowerCaseMessage; +use Foo\testLowerCaseEnum; use Php\Test\TestNamespace; class GeneratedClassTest extends TestBase @@ -715,4 +717,14 @@ class GeneratedClassTest extends TestBase $this->assertSame("abc", $m->getB()); $this->assertNotSame("abc", $m->getA()); } + + ######################################################### + # Test Reverse Field Order. + ######################################################### + + public function testLowerCase() + { + $m = new testLowerCaseMessage(); + $n = testLowerCaseEnum::VALUE; + } } diff --git a/php/tests/memory_leak_test.php b/php/tests/memory_leak_test.php index a92694d0..7c3a1801 100644 --- a/php/tests/memory_leak_test.php +++ b/php/tests/memory_leak_test.php @@ -23,6 +23,8 @@ require_once('generated/Foo/TestPhpDoc.php'); require_once('generated/Foo/TestRandomFieldOrder.php'); require_once('generated/Foo/TestReverseFieldOrder.php'); require_once('generated/Foo/TestUnpackedMessage.php'); +require_once('generated/Foo/testLowerCaseMessage.php'); +require_once('generated/Foo/testLowerCaseEnum.php'); require_once('generated/GPBMetadata/Proto/Test.php'); require_once('generated/GPBMetadata/Proto/TestEmptyPhpNamespace.php'); require_once('generated/GPBMetadata/Proto/TestInclude.php'); diff --git a/php/tests/proto/test.proto b/php/tests/proto/test.proto index a90f3d1d..56cba446 100644 --- a/php/tests/proto/test.proto +++ b/php/tests/proto/test.proto @@ -192,3 +192,10 @@ message TestReverseFieldOrder { repeated int32 a = 2; string b = 1; } + +message testLowerCaseMessage { +} + +enum testLowerCaseEnum { + VALUE = 0; +} |