Skip to content

Commit 7662a9b

Browse files
committed
Update common patches
1 parent 865d464 commit 7662a9b

6 files changed

Lines changed: 46 additions & 18 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
patch_amqp() {
2+
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
3+
get -q -n amqp_connection_resource.c https://raw.githubusercontent.com/remicollet/php-amqp/977449987412a3d5c59a036dbab8b6d67764bb3e/amqp_connection_resource.c
4+
fi
5+
}
Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,35 @@
1-
process_file() {
2-
local file=$1
3-
sed -i'' -e '0,/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\).*/s//\#include <ext\/random\/php_random.h>/' "$file"
4-
sed -i'' -e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' "$file"
1+
patch_84() {
2+
sed -i.bak \
3+
-e '0,/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\).*/s//#include <ext\/random\/php_random.h>/' \
4+
-e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' \
5+
"$1" && rm -rf *.bak
56
}
67

7-
export -f process_file
8+
patch_85() {
9+
sed -i.bak \
10+
-e 's#ext/standard/php_smart_string.h#Zend/zend_smart_string.h#g' \
11+
-e 's#ext/standard/php_smart_string_public.h#Zend/zend_smart_string.h#g' \
12+
-e 's#zend_exception_get_default(TSRMLS_C)#zend_ce_exception#g' \
13+
-e 's#zend_exception_get_default()#zend_ce_exception#g' \
14+
"$1" && rm -rf *.bak
15+
}
16+
17+
version_ge() {
18+
ver=$1
19+
min=$2
20+
[[ $(printf '%s\n%s\n' "$ver" "$min" | sort -V | head -n1) == "$min" ]]
21+
}
22+
23+
if version_ge "${version:?}" "8.4"; then
24+
while IFS= read -r file; do
25+
patch_84 "$file"
26+
done < <(grep -rlE 'php_lcg\.h|php_mt_rand\.h|php_rand\.h|standard/php_random\.h' \
27+
--include='*.c' --include='*.h' . || true)
28+
fi
829

9-
# Compare with 8.3 so it runs only on 8.4 and above
10-
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
11-
find . -type f \( -name "*.c" -o -name "*.h" \) -exec bash -c 'process_file "$0"' {} \;
30+
if version_ge "${version:?}" "8.5"; then
31+
while IFS= read -r file; do
32+
patch_85 "$file"
33+
done < <(grep -rlE 'ext/standard/php_smart_string(_public)?\.h|zend_exception_get_default' \
34+
--include='*.c' --include='*.h' . || true)
1235
fi

src/scripts/extensions/patches/gearman.sh

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
patch_geos() {
2-
php_version_id="$(php -r "echo PHP_VERSION_ID;")"
3-
if [ "$php_version_id" -ge 70000 ]; then
2+
if [[ $(printf '%s\n%s\n' "${version:?}" "7.0" | sort -V | head -n1) == "7.0" ]]; then
43
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
54
fi
6-
if [ "$php_version_id" -ge 80500 ]; then
7-
sed -i~ -e "s/zend_exception_get_default(TSRMLS_C)/zend_ce_exception/" geos.c
8-
fi
95
get -q -n /tmp/php8.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0003-add-all-arginfo-and-fix-build-with-PHP-8.patch
106
get -q -n /tmp/toString.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0006-fix-__toString-with-8.2.patch
117
patch -p1 < /tmp/php8.patch 2>/dev/null || true
128
patch -p1 < /tmp/toString.patch 2>/dev/null || true
139
}
10+
}

src/scripts/extensions/patches/pdo_oci.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
patch_pdo_oci() {
22
get -q -n config.m4 https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
3+
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
4+
get -q -n pdo_oci.c https://raw.githubusercontent.com/shivammathur/pecl-database-pdo_oci/a9cf2c53b6de46f9e5f523bcd11fd344e3beeb85/pdo_oci.c
5+
fi
36
if [[ ${version:?} =~ 5.[3-6] ]]; then
47
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
58
fi
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
2+
sed -i.bak -e 's/zval_ptr_dtor( &dbh->query_stmt_zval );/OBJ_RELEASE(dbh->query_stmt_obj);dbh->query_stmt_obj = NULL;/' php_pdo_sqlsrv_int.h
3+
sed -i.bak -e 's/pdo_error_mode prev_err_mode/uint8_t prev_err_mode/g' pdo_dbh.cpp
4+
rm -rf *.bak
5+
fi

0 commit comments

Comments
 (0)