Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update driver to PHP8.1 #171

Closed
oleggr opened this issue Feb 24, 2022 · 3 comments
Closed

Update driver to PHP8.1 #171

oleggr opened this issue Feb 24, 2022 · 3 comments
Assignees

Comments

@oleggr
Copy link

oleggr commented Feb 24, 2022

We use this driver in project on PHP7.4 currently. Now we want to update PHP version to 8.1.2 so we need driver to support this version. We use ondrej/php repo for PHP, Ubuntu 18.04 bionic and Ubuntu 16.04 xenial. Probably builded file will be ok. Help us pls.

@oleggr
Copy link
Author

oleggr commented Feb 24, 2022

PHP 8.1.2 (cli) (built: Jan 24 2022 10:42:15) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.2, Copyright (c) Zend Technologies
with Zend OPcache v8.1.2, Copyright (c), by Zend Technologies

@Totktonada Totktonada self-assigned this Apr 7, 2022
Totktonada pushed a commit to mikhainin/tarantool-php that referenced this issue Apr 11, 2022
The TSRM* macros are no-op since PHP 7.0. PHP 8.0 drops them at all.
Define them as no-op in our code when building against PHP 8 and newer
to overcome a build fail. See [1] and [2] (1.c) for details.

Those macros could be removed from the code entirely (both definitions
and usages), since we support PHP 7.0+. It is to be done later.

[1]: https://wiki.php.net/rfc/native-tls
[2]: https://github.com/php/php-src/blob/php-8.0.18RC1/UPGRADING.INTERNALS

Part of tarantool#171
Totktonada pushed a commit to mikhainin/tarantool-php that referenced this issue Apr 11, 2022
The `nNextFreeElement` field is initialized with `ZEND_LONG_MIN` instead
of zero since PHP 8.0. Adjust our `php_mp_is_hash()` check accordingly.
See [1] and [2] for details.

NB: PHP 8.1 introduces `zend_array_is_list()`, which may be used here.
See [3] and [4] for details.

[1]: https://wiki.php.net/rfc/negative_array_index
[2]: php/php-src#3772
[3]: https://wiki.php.net/rfc/is_list
[4]: php/php-src#6070

Since I don't observe any other problems on PHP 8.1, closing the
relevant issue.

Fixes tarantool#171
Totktonada pushed a commit that referenced this issue Apr 11, 2022
The TSRM* macros are no-op since PHP 7.0. PHP 8.0 drops them at all.
Define them as no-op in our code when building against PHP 8 and newer
to overcome a build fail. See [1] and [2] (1.c) for details.

Those macros could be removed from the code entirely (both definitions
and usages), since we support PHP 7.0+. It is to be done later.

[1]: https://wiki.php.net/rfc/native-tls
[2]: https://github.com/php/php-src/blob/php-8.0.18RC1/UPGRADING.INTERNALS

Part of #171
@Totktonada
Copy link
Member

@negram fixed all known problems on PHP 8.0 and 8.1.

I'll follow up with packages.

@Totktonada
Copy link
Member

I can't build a package for Ubuntu Xenial, because ppa:ondrej/php does not support it anymore. If you still need it, please, give me a recipe how to get a PHP 8.1 package on Ubuntu Xenial and I'll try again.

Cite from https://github.com/oerdnj/deb.sury.org/wiki/Frequently-Asked-Questions:

Debian 8 Jessie and Ubuntu 16.04 Xenial LTS are available as paid option from PHP LTS by Freexian as a collaboration between DEB.SURY.ORG and Freexian.

Patch (Ubuntu 18.04 Bionic, PHP 8.1 from ppa:ondrej/php)
diff --git a/debian/prebuild.sh b/debian/prebuild.sh
index c17d14c..f277e7e 100755
--- a/debian/prebuild.sh
+++ b/debian/prebuild.sh
@@ -11,6 +11,12 @@ SUDO="sudo -E"
 ${SUDO} apt-get update > /dev/null
 ${SUDO} apt-get -y install php-all-dev
 
+# Build against php8.1 on Ubuntu Bionic.
+${SUDO} apt-get install -y software-properties-common
+${SUDO} add-apt-repository -y ppa:ondrej/php
+${SUDO} apt-get update > /dev/null
+${SUDO} apt-get install -y php8.1-dev
+
 phpversion=$(php-config --version | sed 's/^\([0-9]\+\.[0-9]\).*/\1/')
 
 cd /build/php-tarantool-*
diff --git a/test.pkg.all.sh b/test.pkg.all.sh
index 138a1b0..388cc62 100755
--- a/test.pkg.all.sh
+++ b/test.pkg.all.sh
@@ -3,27 +3,9 @@
 set -exu  # Strict shell (w/o -o pipefail)
 
 distros="
-    el:8
-    fedora:25
-    fedora:26
-    fedora:27
-    fedora:28
-    fedora:29
-    fedora:30
-    fedora:31
-    debian:stretch
-    debian:buster
-    ubuntu:xenial
     ubuntu:bionic
-    ubuntu:eoan
-    ubuntu:focal
 "
 
-if ! type packpack; then
-    echo "Unable to find packpack"
-    exit 1
-fi
-
 for distro in $distros; do
     export OS="${distro%%:*}"
     export DIST="${distro#*:}"
@@ -31,9 +13,6 @@ for distro in $distros; do
         export OS=centos
     fi
 
-    rm -rf build
-    packpack
-
     docker run \
         --volume "$(realpath .):/tarantool-php" \
         --workdir /tarantool-php                \
diff --git a/test.pkg.sh b/test.pkg.sh
index 3c1c271..648d324 100755
--- a/test.pkg.sh
+++ b/test.pkg.sh
@@ -16,7 +16,7 @@ elif type apt-get; then
     PM_SYNC='apt-get update'
     PM_INSTALL_NAME='apt-get -qy install'
     PM_INSTALL_FILE='dpkg -i'
-    PKG_GLOB='php7.?-tarantool*_amd64.deb'
+    PKG_GLOB='php8.?-tarantool*_amd64.deb'
     # Prevent packages like tzdata from asking configuration
     # parameters interactively.
     # See https://github.com/packpack/packpack/issues/7
@@ -29,8 +29,14 @@ fi
 # Update available packages list.
 ${PM_SYNC}
 
+# Verify against php8.1 on Ubuntu Bionic.
+apt-get -y install software-properties-common
+add-apt-repository -y ppa:ondrej/php
+apt-get update > /dev/null
+
 # Install php interpreter.
-${PM_INSTALL_NAME} php
+apt-get install -y php8.1
+php --version
 
 # Install php-tarantool package.
 ${PM_INSTALL_FILE} build/${PKG_GLOB}

How to build and verify:

$ OS=ubuntu DIST=bionic /path/to/packpack/packpack # build
$ ./test.pkg.all.sh # verify

Mostly the same as #117 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants