Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
15 changes: 8 additions & 7 deletions protobuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
*int64_out_p = (int64_t)Z_LVAL_P(zval); \
}


#define GET_INSTANCE() (zend_object *) Z_OBJ_P (getThis())


enum
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions tests/Foo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down