diff --git a/README.md b/README.md index edf9f3c..a6f6be6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -This fork is PHP 8.x temp patch +This fork is PHP 8.4 temp patch ======================================= ⚠️ The extension can be built under Windows (You can use WSL), but I didn’t figure out how to do it, in this fork everything is translated to properties, since in PHP 8 you can’t create dynamic properties. diff --git a/protobuf.c b/protobuf.c index e272f3e..9e68a4e 100644 --- a/protobuf.c +++ b/protobuf.c @@ -55,7 +55,7 @@ *int64_out_p = (int64_t)Z_LVAL_P(zval); \ } - +#define GET_INSTANCE() (zend_object *) Z_OBJ_P (getThis()) enum @@ -94,7 +94,7 @@ PHP_METHOD(ProtobufMessage, __construct) { zval values_array; array_init(&values_array); - zend_update_property(pb_entry, getThis(), PB_VALUES_PROPERTY, sizeof(PB_VALUES_PROPERTY) - 1, &values_array); + zend_update_property(pb_entry, GET_INSTANCE(), PB_VALUES_PROPERTY, sizeof(PB_VALUES_PROPERTY) - 1, &values_array); } PHP_METHOD(ProtobufMessage, append) @@ -414,7 +414,7 @@ PHP_METHOD(ProtobufMessage, parseFromString) break; default: - PB_PARSE_ERROR("unexpected wire type %ld for unexpected %lu field", wire_type, (uint64_t)field_number); + PB_PARSE_ERROR("unexpected wire type %u for unexpected %lu field", wire_type, (uint64_t)field_number); goto fail0; } @@ -669,6 +669,7 @@ ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_get, 0, 0, 1) ZEND_ARG_INFO(0, position) + ZEND_ARG_INFO(0, index) ZEND_END_ARG_INFO() ZEND_BEGIN_ARG_INFO_EX(arginfo_parseFromString, 0, 0, 1) @@ -792,7 +793,7 @@ static int pb_assign_value(zval *this, zval *dst, zval *src, zend_ulong field_nu break; default: - PB_COMPILE_ERROR_EX(this, "unexpected '%s' field type %d in field descriptor", pb_get_field_name(this, field_number), zend_get_type_by_const(Z_LVAL_P(type))); + PB_COMPILE_ERROR_EX(this, "unexpected '%s' field type %s in field descriptor", pb_get_field_name(this, field_number), zend_get_type_by_const(Z_LVAL_P(type))); goto fail2; } @@ -1107,7 +1108,7 @@ static int pb_parse_field_value(zval *this, reader_t *reader, zend_ulong field_n break; default: - PB_COMPILE_ERROR_EX(this, "unexpected '%s' field type %d in field descriptor", pb_get_field_name(this, field_number), field_type); + PB_COMPILE_ERROR_EX(this, "unexpected '%s' field type %ld in field descriptor", pb_get_field_name(this, field_number), field_type); return -1; } @@ -1186,7 +1187,7 @@ static int pb_serialize_field_value(zval *this, writer_t *writer, zend_ulong fie break; default: - PB_COMPILE_ERROR_EX(this, "unexpected '%s' field type %d in field descriptor", pb_get_field_name(this, field_number), Z_LVAL_P(type)); + PB_COMPILE_ERROR_EX(this, "unexpected '%s' field type %ld in field descriptor", pb_get_field_name(this, field_number), Z_LVAL_P(type)); return -1; } @@ -1236,7 +1237,7 @@ static int pb_serialize_packed_field(zval *this, writer_t *writer, zend_ulong fi break; default: - PB_COMPILE_ERROR_EX(this, "unexpected '%s' type %d for packed field in field descriptor", pb_get_field_name(this, field_number), field_type); + PB_COMPILE_ERROR_EX(this, "unexpected '%s' type %ld for packed field in field descriptor", pb_get_field_name(this, field_number), field_type); return -1; } diff --git a/tests/Foo.php b/tests/Foo.php index 3e2ddb9..8686077 100644 --- a/tests/Foo.php +++ b/tests/Foo.php @@ -814,7 +814,7 @@ public function getRepeatedFieldCount() * * @return null */ - public function setEmbeddedField(\Bar $value=null) + public function setEmbeddedField(?\Bar $value=null) { return $this->set(self::EMBEDDED_FIELD, $value); } @@ -1364,7 +1364,7 @@ public function getBoolPackedFieldCount() * * @return null */ - public function setOptionalEmbeddedField(\Baz $value=null) + public function setOptionalEmbeddedField(?\Baz $value=null) { return $this->set(self::OPTIONAL_EMBEDDED_FIELD, $value); }