Skip to content

Commit c9eb925

Browse files
committed
Add patch for zval_dtor for extensions in 8.6
1 parent 46c9f71 commit c9eb925

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

scripts/patch-extensions.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ patch_xdebug() {
4646
[[ "$PHP_VERSION" = "8.5" || "$PHP_VERSION" = "8.6" ]] && sed -i 's#ext/standard/php_smart_string.h#Zend/zend_smart_string.h#' src/develop/stack.c src/lib/var.c
4747
[[ "$PHP_VERSION" = "8.4" || "$PHP_VERSION" = "8.5" ]] && sed -i -e "s|ext/standard/php_lcg.h|ext/random/php_random.h|" src/lib/usefulstuff.c
4848
[[ "$PHP_VERSION" = "8.6" ]] && sed -i 's/ZSTR_INIT_LITERAL(tmp_name, false)/zend_string_init(tmp_name, strlen(tmp_name), false)/g' src/profiler/profiler.c
49+
if [[ "$PHP_VERSION" = "8.6" ]]; then
50+
for file in src/debugger/debugger.c src/debugger/handler_dbgp.c src/base/base.c; do
51+
sed -i 's/zval_dtor/zval_ptr_dtor_nogc/' $file
52+
done
53+
fi
4954
}
5055

5156
# Function to patch amqp source.
@@ -58,11 +63,17 @@ patch_memcache() {
5863
[[ "$PHP_VERSION" = "8.3" || "$PHP_VERSION" = "8.4" || "$PHP_VERSION" = "8.5" || "$PHP_VERSION" = "8.6" ]] && sed -i "s/#include <string.h>/#include <string.h>\n#include <errno.h>/" src/memcache_pool.h
5964
[[ "$PHP_VERSION" = "8.5" || "$PHP_VERSION" = "8.6" ]] && sed -i 's#ext/standard/php_smart_string.h#Zend/zend_smart_string.h#' src/memcache_ascii_protocol.c src/memcache_binary_protocol.c src/memcache_pool.c src/memcache_session.c
6065
[[ "$PHP_VERSION" = "8.5" || "$PHP_VERSION" = "8.6" ]] && sed -i 's#ext/standard/php_smart_string_public.h#Zend/zend_smart_string.h#' src/memcache_pool.h
66+
if [[ "$PHP_VERSION" = "8.6" ]]; then
67+
for file in src/memcache_pool.c src/memcache_session.c src/memcache_binary_protocol.c src/memcache.c; do
68+
sed -i 's/zval_dtor/zval_ptr_dtor_nogc/' $file
69+
done
70+
fi
6171
}
6272

6373
# Function to patch memcached source.
6474
patch_memcached() {
6575
[[ "$PHP_VERSION" = "8.3" || "$PHP_VERSION" = "8.4" || "$PHP_VERSION" = "8.5" ]] && sed -i "s/#include \"php.h\"/#include <errno.h>\n#include \"php.h\"/" php_memcached.h
76+
[[ "$PHP_VERSION" = "8.6" ]] && sed -i 's/zval_dtor/zval_ptr_dtor_nogc/' php_memcached.c
6677
}
6778

6879
# Function to patch redis source.
@@ -78,27 +89,57 @@ patch_redis() {
7889
for file in library.c redis_commands.c cluster_library.c; do
7990
sed -i 's/zval_is_true/zend_is_true/' $file
8091
done
92+
for file in redis_array_impl.c redis_array.c redis_commands.c redis_cluster.c cluster_library.c library.c redis.c redis_session.c; do
93+
sed -i 's/zval_dtor/zval_ptr_dtor_nogc/' $file
94+
done
8195
fi
8296
}
8397

8498
# Function to patch igbinary source.
8599
patch_igbinary() {
86100
[[ "$PHP_VERSION" = "8.3" || "$PHP_VERSION" = "8.4" || "$PHP_VERSION" = "8.5" || "$PHP_VERSION" = "8.6" ]] && find . -type f -exec sed -i 's/zend_uintptr_t/uintptr_t/g' {} +;
87101
[[ "$PHP_VERSION" = "8.5" || "$PHP_VERSION" = "8.6" ]] && sed -i 's#ext/standard/php_smart_string.h#Zend/zend_smart_string.h#' src/php7/php_igbinary.h
102+
[[ "$PHP_VERSION" = "8.6" ]] && sed -i 's/zval_dtor/zval_ptr_dtor_nogc/' src/php7/igbinary.c
88103
}
89104

90105
# Function to path yaml source
91106
patch_yaml() {
92107
[[ "$PHP_VERSION" = "8.5" || "$PHP_VERSION" = "8.6" ]] && sed -i 's#ext/standard/php_smart_string.h#Zend/zend_smart_string.h#' php_yaml.h
108+
if [[ "$PHP_VERSION" = "8.6" ]]; then
109+
for file in yaml.c parse.c; do
110+
sed -i 's/zval_dtor/zval_ptr_dtor_nogc/' $file
111+
done
112+
fi
93113
}
94114

95115
# Function to path zmq source
96116
patch_zmq() {
97117
[[ "$PHP_VERSION" = "8.5" || "$PHP_VERSION" = "8.6" ]] && sed -i 's/zend_exception_get_default()/zend_ce_exception/' zmq.c
98118
[[ "$PHP_VERSION" = "8.6" ]] && sed -i 's/zval_is_true/zend_is_true/' zmq_device.c
119+
if [[ "$PHP_VERSION" = "8.6" ]]; then
120+
for file in zmq_pollset.c php5/zmq_pollset.c php5/zmq.c zmq.c; do
121+
sed -i 's/zval_dtor/zval_ptr_dtor_nogc/' $file
122+
done
123+
fi
99124
}
100125

126+
# Function to patch mongodb source.
101127
patch_mongodb() {
102128
[[ "$PHP_VERSION" = "8.6" ]] && sed -i 's/ZVAL_IS_NULL/Z_ISNULL_P/' src/MongoDB/ServerApi.c
103129
[[ "$PHP_VERSION" = "8.6" ]] && sed -i 's/zval_is_true/zend_is_true/' src/MongoDB/ServerApi.c
130+
[[ "$PHP_VERSION" = "8.6" ]] && sed -i 's/zval_dtor/zval_ptr_dtor_nogc/' src/MongoDB/Cursor.c
131+
}
132+
133+
# Function to patch apcu source.
134+
patch_apcu() {
135+
[[ "$PHP_VERSION" = "8.6" ]] && sed -i 's/zval_dtor/zval_ptr_dtor_nogc/' apc_cache.c
104136
}
137+
138+
# Function to patch msgpack source.
139+
patch_msgpack() {
140+
if [[ "$PHP_VERSION" = "8.6" ]]; then
141+
for file in msgpack.c msgpack_unpack.c; do
142+
sed -i 's/zval_dtor/zval_ptr_dtor_nogc/' $file
143+
done
144+
fi
145+
}

0 commit comments

Comments
 (0)