aboutsummaryrefslogtreecommitdiff
path: root/php/src/Google
diff options
context:
space:
mode:
Diffstat (limited to 'php/src/Google')
-rw-r--r--php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php16
-rw-r--r--php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php16
-rw-r--r--php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php16
-rw-r--r--php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php16
-rw-r--r--php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php16
-rw-r--r--php/src/Google/Protobuf/Internal/FieldOptions_CType.php16
-rw-r--r--php/src/Google/Protobuf/Internal/FieldOptions_JSType.php16
-rw-r--r--php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php16
-rw-r--r--php/src/Google/Protobuf/Internal/GPBJsonWire.php2
-rw-r--r--php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php16
-rw-r--r--php/src/Google/Protobuf/Internal/Message.php2
-rw-r--r--php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php16
-rw-r--r--php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php16
-rw-r--r--php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php16
-rw-r--r--php/src/Google/Protobuf/Timestamp.php17
15 files changed, 204 insertions, 9 deletions
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php
new file mode 100644
index 00000000..c928fbe5
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/DescriptorProto_ExtensionRange.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\DescriptorProto\ExtensionRange instead.
+ * @deprecated
+ */
+ class DescriptorProto_ExtensionRange {}
+}
+class_exists(DescriptorProto\ExtensionRange::class);
+@trigger_error('Google\Protobuf\Internal\DescriptorProto_ExtensionRange is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\DescriptorProto\ExtensionRange instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php b/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php
new file mode 100644
index 00000000..e49e945f
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/DescriptorProto_ReservedRange.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\DescriptorProto\ReservedRange instead.
+ * @deprecated
+ */
+ class DescriptorProto_ReservedRange {}
+}
+class_exists(DescriptorProto\ReservedRange::class);
+@trigger_error('Google\Protobuf\Internal\DescriptorProto_ReservedRange is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\DescriptorProto\ReservedRange instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php b/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php
new file mode 100644
index 00000000..b1b59ed9
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/EnumDescriptorProto_EnumReservedRange.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange instead.
+ * @deprecated
+ */
+ class EnumDescriptorProto_EnumReservedRange {}
+}
+class_exists(EnumDescriptorProto\EnumReservedRange::class);
+@trigger_error('Google\Protobuf\Internal\EnumDescriptorProto_EnumReservedRange is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\EnumDescriptorProto\EnumReservedRange instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php
new file mode 100644
index 00000000..218a846e
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Label.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\FieldDescriptorProto\Label instead.
+ * @deprecated
+ */
+ class FieldDescriptorProto_Label {}
+}
+class_exists(FieldDescriptorProto\Label::class);
+@trigger_error('Google\Protobuf\Internal\FieldDescriptorProto_Label is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\FieldDescriptorProto\Label instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php
new file mode 100644
index 00000000..fd8d449a
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/FieldDescriptorProto_Type.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\FieldDescriptorProto\Type instead.
+ * @deprecated
+ */
+ class FieldDescriptorProto_Type {}
+}
+class_exists(FieldDescriptorProto\Type::class);
+@trigger_error('Google\Protobuf\Internal\FieldDescriptorProto_Type is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\FieldDescriptorProto\Type instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_CType.php b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php
new file mode 100644
index 00000000..4d18783e
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/FieldOptions_CType.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\FieldOptions\CType instead.
+ * @deprecated
+ */
+ class FieldOptions_CType {}
+}
+class_exists(FieldOptions\CType::class);
+@trigger_error('Google\Protobuf\Internal\FieldOptions_CType is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\FieldOptions\CType instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php
new file mode 100644
index 00000000..9db07822
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/FieldOptions_JSType.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\FieldOptions\JSType instead.
+ * @deprecated
+ */
+ class FieldOptions_JSType {}
+}
+class_exists(FieldOptions\JSType::class);
+@trigger_error('Google\Protobuf\Internal\FieldOptions_JSType is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\FieldOptions\JSType instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php
new file mode 100644
index 00000000..8926e63b
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/FileOptions_OptimizeMode.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\FileOptions\OptimizeMode instead.
+ * @deprecated
+ */
+ class FileOptions_OptimizeMode {}
+}
+class_exists(FileOptions\OptimizeMode::class);
+@trigger_error('Google\Protobuf\Internal\FileOptions_OptimizeMode is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\FileOptions\OptimizeMode instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/GPBJsonWire.php b/php/src/Google/Protobuf/Internal/GPBJsonWire.php
index 9ae57ab3..43f4745d 100644
--- a/php/src/Google/Protobuf/Internal/GPBJsonWire.php
+++ b/php/src/Google/Protobuf/Internal/GPBJsonWire.php
@@ -226,7 +226,7 @@ class GPBJsonWire
$output->writeRaw("\"", 1);
break;
case GPBType::STRING:
- $value = json_encode($value);
+ $value = json_encode($value, JSON_UNESCAPED_UNICODE);
$output->writeRaw($value, strlen($value));
break;
// case GPBType::GROUP:
diff --git a/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
new file mode 100644
index 00000000..e36f1e57
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/GeneratedCodeInfo_Annotation.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\GeneratedCodeInfo\Annotation instead.
+ * @deprecated
+ */
+ class GeneratedCodeInfo_Annotation {}
+}
+class_exists(GeneratedCodeInfo\Annotation::class);
+@trigger_error('Google\Protobuf\Internal\GeneratedCodeInfo_Annotation is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\GeneratedCodeInfo\Annotation instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/Message.php b/php/src/Google/Protobuf/Internal/Message.php
index 73ac375e..8ff141ca 100644
--- a/php/src/Google/Protobuf/Internal/Message.php
+++ b/php/src/Google/Protobuf/Internal/Message.php
@@ -1563,7 +1563,7 @@ class Message
}
break;
case GPBType::STRING:
- $value = json_encode($value);
+ $value = json_encode($value, JSON_UNESCAPED_UNICODE);
$size += strlen($value);
break;
case GPBType::BYTES:
diff --git a/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php
new file mode 100644
index 00000000..a2913114
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/MethodOptions_IdempotencyLevel.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\MethodOptions\IdempotencyLevel instead.
+ * @deprecated
+ */
+ class MethodOptions_IdempotencyLevel {}
+}
+class_exists(MethodOptions\IdempotencyLevel::class);
+@trigger_error('Google\Protobuf\Internal\MethodOptions_IdempotencyLevel is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\MethodOptions\IdempotencyLevel instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
new file mode 100644
index 00000000..1346492d
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/SourceCodeInfo_Location.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\SourceCodeInfo\Location instead.
+ * @deprecated
+ */
+ class SourceCodeInfo_Location {}
+}
+class_exists(SourceCodeInfo\Location::class);
+@trigger_error('Google\Protobuf\Internal\SourceCodeInfo_Location is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\SourceCodeInfo\Location instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php b/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php
new file mode 100644
index 00000000..9750eb01
--- /dev/null
+++ b/php/src/Google/Protobuf/Internal/UninterpretedOption_NamePart.php
@@ -0,0 +1,16 @@
+<?php
+# Generated by the protocol buffer compiler. DO NOT EDIT!
+# source: google/protobuf/descriptor.proto
+
+namespace Google\Protobuf\Internal;
+
+if (false) {
+ /**
+ * This class is deprecated. Use Google\Protobuf\Internal\UninterpretedOption\NamePart instead.
+ * @deprecated
+ */
+ class UninterpretedOption_NamePart {}
+}
+class_exists(UninterpretedOption\NamePart::class);
+@trigger_error('Google\Protobuf\Internal\UninterpretedOption_NamePart is deprecated and will be removed in the next major release. Use Google\Protobuf\Internal\UninterpretedOption\NamePart instead', E_USER_DEPRECATED);
+
diff --git a/php/src/Google/Protobuf/Timestamp.php b/php/src/Google/Protobuf/Timestamp.php
index e21f3231..6d26f6c5 100644
--- a/php/src/Google/Protobuf/Timestamp.php
+++ b/php/src/Google/Protobuf/Timestamp.php
@@ -55,7 +55,9 @@ use Google\Protobuf\Internal\GPBUtil;
* {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional
* seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution),
* are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone
- * is required, though only UTC (as indicated by "Z") is presently supported.
+ * is required. A proto3 JSON serializer should always use UTC (as indicated by
+ * "Z") when printing the Timestamp type and a proto3 JSON parser should be
+ * able to accept both UTC and other timezones (as indicated by an offset).
* For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past
* 01:30 UTC on January 15, 2017.
* In JavaScript, one can convert a Date object to this format using the
@@ -64,8 +66,8 @@ use Google\Protobuf\Internal\GPBUtil;
* to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime)
* with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one
* can use the Joda Time's [`ISODateTimeFormat.dateTime()`](
- * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--)
- * to obtain a formatter capable of generating timestamps in this format.
+ * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--
+ * ) to obtain a formatter capable of generating timestamps in this format.
*
* Generated from protobuf message <code>google.protobuf.Timestamp</code>
*/
@@ -180,18 +182,19 @@ class Timestamp extends \Google\Protobuf\Internal\Message
*/
public function fromDateTime(\DateTime $datetime)
{
- $this->seconds = $datetime->format('U');
- $this->nanos = 0;
+ $this->seconds = $datetime->getTimestamp();
+ $this->nanos = 1000 * $datetime->format('u');
}
/**
- * Converts Timestamp to PHP DateTime. Nano second is ignored.
+ * Converts Timestamp to PHP DateTime.
*
* @return \DateTime $datetime
*/
public function toDateTime()
{
- return \DateTime::createFromFormat('U', $this->seconds);
+ $time = sprintf('%s.%06d', $this->seconds, $this->nanos / 1000);
+ return \DateTime::createFromFormat('U.u', $time);
}
}