1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

Fix build with PHP 7.3

This commit is contained in:
Sunpoet Po-Chuan Hsieh 2018-10-14 16:28:27 +00:00
parent a59643c1a2
commit ce68bff524
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=482057
4 changed files with 150 additions and 1 deletions

View File

@ -15,7 +15,7 @@ LICENSE_FILE= ${WRKSRC}/LICENSE
USES= php:ext
CONFIGURE_ARGS= --with-tarantool
IGNORE_WITH_PHP=56 73
IGNORE_WITH_PHP=56
USE_GITHUB= yes
GH_PROJECT= ${PORTNAME}-php

View File

@ -0,0 +1,14 @@
--- src/tarantool.c.orig 2018-04-18 13:33:56 UTC
+++ src/tarantool.c
@@ -1151,7 +1151,11 @@ PHP_METHOD(Tarantool, __construct) {
memset(&le, 0, sizeof(zend_resource));
le.type = php_tarantool_list_entry();
le.ptr = obj;
+#if PHP_VERSION_ID >= 70300
+ GC_SET_REFCOUNT(&le, 1);
+#else
GC_REFCOUNT(&le) = 1;
+#endif
assert(plist_id != NULL);
if (zend_hash_update_mem(&EG(persistent_list), plist_id,

View File

@ -0,0 +1,122 @@
--- src/tarantool_msgpack.c.orig 2018-04-18 13:33:56 UTC
+++ src/tarantool_msgpack.c
@@ -123,15 +123,30 @@ void php_mp_pack_array_recursively(smart
for (; key_index < n; ++key_index) {
data = zend_hash_index_find(ht, key_index);
if (!data || data == val || (Z_TYPE_P(data) == IS_ARRAY &&
+#if PHP_VERSION_ID >= 70300
+ !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE) &&
+ GC_IS_RECURSIVE(Z_ARRVAL_P(data)))) {
+#else
ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)) &&
Z_ARRVAL_P(data)->u.v.nApplyCount > 1)) {
+#endif
php_mp_pack_nil(str);
} else {
+#if PHP_VERSION_ID >= 70300
+ if (Z_TYPE_P(data) == IS_ARRAY && !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE))
+ GC_PROTECT_RECURSION(Z_ARRVAL_P(data));
+#else
if (Z_TYPE_P(data) == IS_ARRAY && ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)))
Z_ARRVAL_P(data)->u.v.nApplyCount++;
+#endif
php_mp_pack(str, data);
+#if PHP_VERSION_ID >= 70300
+ if (Z_TYPE_P(data) == IS_ARRAY && !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE))
+ GC_UNPROTECT_RECURSION(Z_ARRVAL_P(data));
+#else
if (Z_TYPE_P(data) == IS_ARRAY && ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)))
Z_ARRVAL_P(data)->u.v.nApplyCount--;
+#endif
}
}
}
@@ -166,15 +181,30 @@ void php_mp_pack_hash_recursively(smart_
}
data = zend_hash_get_current_data_ex(ht, &pos);
if (!data || data == val || (Z_TYPE_P(data) == IS_ARRAY &&
+#if PHP_VERSION_ID >= 70300
+ !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE) &&
+ GC_IS_RECURSIVE(Z_ARRVAL_P(data)))) {
+#else
ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)) &&
Z_ARRVAL_P(data)->u.v.nApplyCount > 1)) {
+#endif
php_mp_pack_nil(str);
} else {
+#if PHP_VERSION_ID >= 70300
+ if (Z_TYPE_P(data) == IS_ARRAY && !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE))
+ GC_PROTECT_RECURSION(Z_ARRVAL_P(data));
+#else
if (Z_TYPE_P(data) == IS_ARRAY && ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)))
Z_ARRVAL_P(data)->u.v.nApplyCount++;
+#endif
php_mp_pack(str, data);
+#if PHP_VERSION_ID >= 70300
+ if (Z_TYPE_P(data) == IS_ARRAY && !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE))
+ GC_UNPROTECT_RECURSION(Z_ARRVAL_P(data));
+#else
if (Z_TYPE_P(data) == IS_ARRAY && ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)))
Z_ARRVAL_P(data)->u.v.nApplyCount--;
+#endif
}
}
}
@@ -408,14 +438,28 @@ size_t php_mp_sizeof_array_recursively(z
for (; key_index < n; ++key_index) {
data = zend_hash_index_find(ht, key_index);
if (!data || data == val ||
+#if PHP_VERSION_ID >= 70300
+ (Z_TYPE_P(data) == IS_ARRAY && !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE) && GC_IS_RECURSIVE(Z_ARRVAL_P(data)))) {
+#else
(Z_TYPE_P(data) == IS_ARRAY && ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)) && Z_ARRVAL_P(data)->u.v.nApplyCount > 1)) {
+#endif
needed += php_mp_sizeof_nil();
} else {
+#if PHP_VERSION_ID >= 70300
+ if (Z_TYPE_P(data) == IS_ARRAY && !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE))
+ GC_PROTECT_RECURSION(Z_ARRVAL_P(data));
+#else
if (Z_TYPE_P(data) == IS_ARRAY && ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)))
Z_ARRVAL_P(data)->u.v.nApplyCount++;
+#endif
needed += php_mp_sizeof(data);
+#if PHP_VERSION_ID >= 70300
+ if (Z_TYPE_P(data) == IS_ARRAY && !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE))
+ GC_UNPROTECT_RECURSION(Z_ARRVAL_P(data));
+#else
if (Z_TYPE_P(data) == IS_ARRAY && ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)))
Z_ARRVAL_P(data)->u.v.nApplyCount--;
+#endif
}
}
return needed;
@@ -452,14 +496,28 @@ size_t php_mp_sizeof_hash_recursively(zv
}
data = zend_hash_get_current_data_ex(ht, &pos);
if (!data || data == val ||
+#if PHP_VERSION_ID >= 70300
+ (Z_TYPE_P(data) == IS_ARRAY && !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE) && GC_IS_RECURSIVE(Z_ARRVAL_P(data)))) {
+#else
(Z_TYPE_P(data) == IS_ARRAY && ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)) && Z_ARRVAL_P(data)->u.v.nApplyCount > 1)) {
+#endif
needed += php_mp_sizeof_nil();
} else {
+#if PHP_VERSION_ID >= 70300
+ if (Z_TYPE_P(data) == IS_ARRAY && !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE))
+ GC_PROTECT_RECURSION(Z_ARRVAL_P(data));
+#else
if (Z_TYPE_P(data) == IS_ARRAY && ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)))
Z_ARRVAL_P(data)->u.v.nApplyCount++;
+#endif
needed += php_mp_sizeof(data);
+#if PHP_VERSION_ID >= 70300
+ if (Z_TYPE_P(data) == IS_ARRAY && !(GC_FLAGS(Z_ARRVAL_P(data)) & GC_IMMUTABLE))
+ GC_UNPROTECT_RECURSION(Z_ARRVAL_P(data));
+#else
if (Z_TYPE_P(data) == IS_ARRAY && ZEND_HASH_APPLY_PROTECTION(Z_ARRVAL_P(data)))
Z_ARRVAL_P(data)->u.v.nApplyCount--;
+#endif
}
}
return needed;

View File

@ -0,0 +1,13 @@
--- src/utils.c.orig 2018-04-18 13:33:56 UTC
+++ src/utils.c
@@ -29,8 +29,10 @@ const char *tutils_op_to_string(zval *ob
return "RESOURCE";
case(IS_REFERENCE):
return "REFERENCE";
+#if PHP_VERSION_ID < 70300
case(IS_CONSTANT):
return "CONSTANT";
+#endif
case(IS_CONSTANT_AST):
return "CONSTANT_AST";
case(IS_CALLABLE):