mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-11-25 00:28:38 +07:00
Update common patches
This commit is contained in:
5
src/scripts/extensions/patches/amqp.sh
Normal file
5
src/scripts/extensions/patches/amqp.sh
Normal file
@ -0,0 +1,5 @@
|
||||
patch_amqp() {
|
||||
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
|
||||
get -q -n amqp_connection_resource.c https://raw.githubusercontent.com/remicollet/php-amqp/977449987412a3d5c59a036dbab8b6d67764bb3e/amqp_connection_resource.c
|
||||
fi
|
||||
}
|
||||
@ -1,12 +1,35 @@
|
||||
process_file() {
|
||||
local file=$1
|
||||
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"
|
||||
sed -i'' -e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' "$file"
|
||||
patch_84() {
|
||||
sed -i.bak \
|
||||
-e '0,/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\).*/s//#include <ext\/random\/php_random.h>/' \
|
||||
-e '/#include.*\(php_lcg.h\|php_mt_rand.h\|php_rand.h\|standard\/php_random\.h\)/d' \
|
||||
"$1" && rm -rf *.bak
|
||||
}
|
||||
|
||||
export -f process_file
|
||||
patch_85() {
|
||||
sed -i.bak \
|
||||
-e 's#ext/standard/php_smart_string.h#Zend/zend_smart_string.h#g' \
|
||||
-e 's#ext/standard/php_smart_string_public.h#Zend/zend_smart_string.h#g' \
|
||||
-e 's#zend_exception_get_default(TSRMLS_C)#zend_ce_exception#g' \
|
||||
-e 's#zend_exception_get_default()#zend_ce_exception#g' \
|
||||
"$1" && rm -rf *.bak
|
||||
}
|
||||
|
||||
# Compare with 8.3 so it runs only on 8.4 and above
|
||||
if [[ $(printf "%s\n%s" "${version:?}" "8.3" | sort -V | head -n1) != "$version" ]]; then
|
||||
find . -type f \( -name "*.c" -o -name "*.h" \) -exec bash -c 'process_file "$0"' {} \;
|
||||
version_ge() {
|
||||
ver=$1
|
||||
min=$2
|
||||
[[ $(printf '%s\n%s\n' "$ver" "$min" | sort -V | head -n1) == "$min" ]]
|
||||
}
|
||||
|
||||
if version_ge "${version:?}" "8.4"; then
|
||||
while IFS= read -r file; do
|
||||
patch_84 "$file"
|
||||
done < <(grep -rlE 'php_lcg\.h|php_mt_rand\.h|php_rand\.h|standard/php_random\.h' \
|
||||
--include='*.c' --include='*.h' . || true)
|
||||
fi
|
||||
|
||||
if version_ge "${version:?}" "8.5"; then
|
||||
while IFS= read -r file; do
|
||||
patch_85 "$file"
|
||||
done < <(grep -rlE 'ext/standard/php_smart_string(_public)?\.h|zend_exception_get_default' \
|
||||
--include='*.c' --include='*.h' . || true)
|
||||
fi
|
||||
|
||||
@ -1,5 +0,0 @@
|
||||
patch_gearman() {
|
||||
if [[ "${version:?}" =~ ${nightly_versions:?} ]]; then
|
||||
sed -i~ -e "s/zend_exception_get_default()/zend_ce_exception/" php_gearman.c
|
||||
fi
|
||||
}
|
||||
@ -1,13 +1,10 @@
|
||||
patch_geos() {
|
||||
php_version_id="$(php -r "echo PHP_VERSION_ID;")"
|
||||
if [ "$php_version_id" -ge 70000 ]; then
|
||||
if [[ $(printf '%s\n%s\n' "${version:?}" "7.0" | sort -V | head -n1) == "7.0" ]]; then
|
||||
sed -i~ -e "s/, ce->name/, ZSTR_VAL(ce->name)/; s/ulong /zend_ulong /" geos.c
|
||||
fi
|
||||
if [ "$php_version_id" -ge 80500 ]; then
|
||||
sed -i~ -e "s/zend_exception_get_default(TSRMLS_C)/zend_ce_exception/" geos.c
|
||||
fi
|
||||
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
|
||||
get -q -n /tmp/toString.patch https://git.remirepo.net/cgit/rpms/php/php-geos.git/plain/0006-fix-__toString-with-8.2.patch
|
||||
patch -p1 < /tmp/php8.patch 2>/dev/null || true
|
||||
patch -p1 < /tmp/toString.patch 2>/dev/null || true
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
patch_pdo_oci() {
|
||||
get -q -n config.m4 https://raw.githubusercontent.com/php/php-src/PHP-8.0/ext/pdo_oci/config.m4
|
||||
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
|
||||
get -q -n pdo_oci.c https://raw.githubusercontent.com/shivammathur/pecl-database-pdo_oci/a9cf2c53b6de46f9e5f523bcd11fd344e3beeb85/pdo_oci.c
|
||||
fi
|
||||
if [[ ${version:?} =~ 5.[3-6] ]]; then
|
||||
sudo sed -i '' "/PHP_CHECK_PDO_INCLUDES/d" config.m4 2>/dev/null || sudo sed -i "/PHP_CHECK_PDO_INCLUDES/d" config.m4
|
||||
fi
|
||||
|
||||
5
src/scripts/extensions/patches/pdo_sqlsrv.sh
Normal file
5
src/scripts/extensions/patches/pdo_sqlsrv.sh
Normal file
@ -0,0 +1,5 @@
|
||||
if [[ $(printf '%s\n%s\n' "${version:?}" "8.5" | sort -V | head -n1) == "8.5" ]]; then
|
||||
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
|
||||
sed -i.bak -e 's/pdo_error_mode prev_err_mode/uint8_t prev_err_mode/g' pdo_dbh.cpp
|
||||
rm -rf *.bak
|
||||
fi
|
||||
Reference in New Issue
Block a user