Skip to content

Commit

Permalink
#2255 - Add Dockerfile with PHP8.1 and update kernel files
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeckerson committed Aug 7, 2021
1 parent b3eb0cd commit 7402c4c
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 4 deletions.
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,13 @@ services:
- "USER=Zephir"
volumes:
- .:/srv

zephir-8.1:
container_name: phalcon-zephir-8.1
hostname: zephir-81
build: docker/8.1
working_dir: /srv
environment:
- "USER=Zephir"
volumes:
- .:/srv
39 changes: 39 additions & 0 deletions docker/8.1/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
FROM composer:2.0.8 as composer
FROM php:8.1-rc-fpm

RUN CPU_CORES="$(getconf _NPROCESSORS_ONLN)";
ENV MAKEFLAGS="-j${CPU_CORES}"

RUN apt update -y && apt install -y \
wget \
zip \
git \
apt-utils \
sudo \
libicu-dev \
libgmp-dev \
libzip-dev && \
pecl install psr

RUN docker-php-ext-install zip gmp intl mysqli && \
docker-php-ext-enable psr

# Install Zephir parser
RUN PHP_INI_DIR="$(dirname "$(php -i | grep /.+/conf.d/.+.ini -oE | head -n 1)")" && \
cd /opt && \
git clone -b "development" \
--depth 1 \
-q https://github.com/phalcon/php-zephir-parser \
php-zephir-parser && \
cd php-zephir-parser || exit 1 && \
phpize && \
./configure --with-php-config="$(command -v php-config)" --enable-zephir_parser && \
make -j"$(getconf _NPROCESSORS_ONLN)" && \
sudo make install && \
echo 'extension="zephir_parser.so"' |\
sudo tee "$PHP_INI_DIR/zephir_parser.ini" && \
php --ri "Zephir Parser"

COPY --from=composer /usr/bin/composer /usr/local/bin/composer

CMD ["php-fpm"]
8 changes: 8 additions & 0 deletions kernels/ZendEngine3/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ int zephir_file_exists(zval *filename)
return FAILURE;
}

#if PHP_VERSION_ID >= 80100
php_stat(Z_STRVAL_P(filename), FS_EXISTS, &return_value);
#else
php_stat(Z_STRVAL_P(filename), (php_stat_len) Z_STRLEN_P(filename), FS_EXISTS, &return_value);
#endif

if (Z_TYPE(return_value) != IS_TRUE) {
return FAILURE;
Expand Down Expand Up @@ -288,7 +292,11 @@ void zephir_file_put_contents(zval *return_value, zval *filename, zval *data)
void zephir_filemtime(zval *return_value, zval *path)
{
if (EXPECTED(Z_TYPE_P(path) == IS_STRING)) {
#if PHP_VERSION_ID >= 80100
php_stat(Z_STRVAL_P(path), FS_MTIME, return_value);
#else
php_stat(Z_STRVAL_P(path), (php_stat_len)(Z_STRLEN_P(path)), FS_MTIME, return_value);
#endif
} else {
ZVAL_FALSE(return_value);
}
Expand Down
6 changes: 3 additions & 3 deletions kernels/ZendEngine3/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void zephir_fast_count(zval *result, zval *value)
}
}

if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) {
if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) {
#if PHP_VERSION_ID >= 80000
zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval);
#else
Expand Down Expand Up @@ -201,7 +201,7 @@ int zephir_fast_count_ev(zval *value)
return (int) count > 0;
}

if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) {
if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) {
#if PHP_VERSION_ID >= 80000
zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval);
#else
Expand Down Expand Up @@ -249,7 +249,7 @@ int zephir_fast_count_int(zval *value)
return (int) count;
}

if (instanceof_function(Z_OBJCE_P(value), spl_ce_Countable)) {
if (instanceof_function(Z_OBJCE_P(value), zend_ce_countable)) {
#if PHP_VERSION_ID >= 80000
zend_call_method_with_0_params(Z_OBJ_P(value), NULL, NULL, "count", &retval);
#else
Expand Down
6 changes: 5 additions & 1 deletion kernels/ZendEngine3/require.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ int zephir_require_ret(zval *return_value_ptr, const char *require_path)
}
#endif

ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE);
#if PHP_VERSION_ID >= 80100
ret = php_stream_open_for_zend_ex(&file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE);
#else
ret = php_stream_open_for_zend_ex(require_path, &file_handle, USE_PATH|STREAM_OPEN_FOR_INCLUDE);
#endif
if (ret != SUCCESS) {
return FAILURE;
}
Expand Down

0 comments on commit 7402c4c

Please sign in to comment.