ADD: added new version of protobuf

This commit is contained in:
Henry Winkel
2022-12-20 10:09:28 +01:00
parent 4a79559129
commit 1e2b3dda7b
1513 changed files with 123720 additions and 83381 deletions

View File

@@ -0,0 +1,39 @@
#!/bin/bash
template_package_xml=$1
release_version=$2
release_files=$3
out=$4
date=$(date +%Y-%m-%d)
time=$(date +%H:%M:%S)
php_version_array=(${release_version//RC/ })
api_version=${php_version_array[0]}
if [ ${#php_version_array[@]} -eq 2 ]; then
rc=${php_version_array[1]}
stability='beta'
else
stability='stable'
fi
files="\\n"
for file in ${release_files//,/ }; do
name=$(echo $file | grep .*[^/]\$ | sed -e "s;protobuf-${release_version}/;;")
if [ ! -z $name ]; then
if [[ $name =~ LICENSE$ ]]; then
role='doc'
else
role='src'
fi
files+=" <file baseinstalldir=\"/\" name=\"${name}\" role=\"${role}\"/>\\n"
fi
done
cat $template_package_xml |
sed -e "s;TEMPLATE_DATE;${date};" |
sed -e "s;TEMPLATE_TIME;${time};" |
sed -e "s;TEMPLATE_PHP_RELEASE;${release_version};" |
sed -e "s;TEMPLATE_PHP_API;${api_version};" |
sed -e "s;TEMPLATE_PHP_STABILITY;${stability};g" |
sed -e "s;TEMPLATE_FILES;${files};" > $out

View File

@@ -601,7 +601,7 @@ PHP_METHOD(Message, __construct) {
//
// However, if the user created their own class derived from Message, this
// will trigger an infinite construction loop and blow the stack. We
// store this `ce` in a global variable to break the cycle (see the check in
// temporarily clear create_object to break this loop (see check in
// NameMap_GetMessage()).
NameMap_EnterConstructor(ce);
desc = Descriptor_GetFromClassEntry(ce);
@@ -646,25 +646,6 @@ PHP_METHOD(Message, clear) {
upb_Message_Clear(intern->msg, intern->desc->msgdef);
}
static bool Message_checkEncodeStatus(upb_EncodeStatus status) {
switch (status) {
case kUpb_EncodeStatus_Ok:
return true;
case kUpb_EncodeStatus_OutOfMemory:
zend_throw_exception_ex(NULL, 0, "Out of memory");
return false;
case kUpb_EncodeStatus_MaxDepthExceeded:
zend_throw_exception_ex(NULL, 0, "Max nesting exceeded");
return false;
case kUpb_EncodeStatus_MissingRequired:
zend_throw_exception_ex(NULL, 0, "Missing required field");
return false;
default:
zend_throw_exception_ex(NULL, 0, "Unknown error encoding");
return false;
}
}
/**
* Message::mergeFrom()
*
@@ -692,9 +673,14 @@ PHP_METHOD(Message, mergeFrom) {
// zend_parse_parameters().
PBPHP_ASSERT(from->desc == intern->desc);
// TODO(haberman): use a temp arena for this.
upb_EncodeStatus status = upb_Encode(from->msg, l, 0, arena, &pb, &size);
if (!Message_checkEncodeStatus(status)) return;
// TODO(haberman): use a temp arena for this once we can make upb_decode()
// copy strings.
pb = upb_Encode(from->msg, l, 0, arena, &size);
if (!pb) {
zend_throw_exception_ex(NULL, 0, "Max nesting exceeded");
return;
}
ok = upb_Decode(pb, size, intern->msg, l, NULL, 0, arena) ==
kUpb_DecodeStatus_Ok;
@@ -744,9 +730,7 @@ PHP_METHOD(Message, serializeToString) {
char *data;
size_t size;
upb_EncodeStatus status =
upb_Encode(intern->msg, l, 0, tmp_arena, &data, &size);
if (!Message_checkEncodeStatus(status)) return;
data = upb_Encode(intern->msg, l, 0, tmp_arena, &size);
if (!data) {
zend_throw_exception_ex(NULL, 0, "Error occurred during serialization");
@@ -1248,12 +1232,8 @@ PHP_METHOD(google_protobuf_Any, pack) {
msg = (Message*)Z_OBJ_P(val);
// Serialize and set value.
char* pb;
upb_EncodeStatus status =
upb_Encode(msg->msg, upb_MessageDef_MiniTable(msg->desc->msgdef), 0,
arena, &pb, &value.size);
if (!Message_checkEncodeStatus(status)) return;
value.data = pb;
value.data = upb_Encode(msg->msg, upb_MessageDef_MiniTable(msg->desc->msgdef),
0, arena, &value.size);
Message_setval(intern, "value", StringVal(value));
// Set type url: type_url_prefix + fully_qualified_name

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -127,7 +127,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_setter, 0, 0, 1)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
#define PHP_PROTOBUF_VERSION "3.21.8"
#define PHP_PROTOBUF_VERSION "3.21.12"
// ptr -> PHP object cache. This is a weak map that caches lazily-created
// wrapper objects around upb types:

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" packagerversion="1.9.5" version="2.0" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 http://pear.php.net/dtd/package-2.0.xsd">
<name>protobuf</name>
<channel>pecl.php.net</channel>
<summary>Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data.</summary>
<description>https://developers.google.com/protocol-buffers/</description>
<lead>
<name>Protobuf Team</name>
<user>protobufpackages</user>
<email>protobuf-packages@google.com</email>
<active>yes</active>
</lead>
<date>TEMPLATE_DATE</date>
<time>TEMPLATE_TIME</time>
<version>
<release>TEMPLATE_PHP_RELEASE</release>
<api>TEMPLATE_PHP_API</api>
</version>
<stability>
<release>TEMPLATE_PHP_STABILITY</release>
<api>TEMPLATE_PHP_STABILITY</api>
</stability>
<license uri="https://opensource.org/licenses/BSD-3-Clause">BSD-3-Clause</license>
<notes>
* See github.com/protocolbuffers/protobuf/releases for release notes.
</notes>
<contents>
<dir baseinstalldir="/" name="/">TEMPLATE_FILES</dir>
</contents>
<dependencies>
<required>
<php>
<min>7.0.0</min>
</php>
<pearinstaller>
<min>1.4.0</min>
</pearinstaller>
</required>
</dependencies>
<providesextension>protobuf</providesextension>
<extsrcrelease/>
</package>