From 61b22789ccb0dd9846b7c3a310cca7015c469b62 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Tue, 30 Jul 2019 00:35:18 +0300 Subject: [PATCH 01/38] Bump version --- Library/Zephir.php | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Zephir.php b/Library/Zephir.php index f079cc9ecf..6a9056fe16 100644 --- a/Library/Zephir.php +++ b/Library/Zephir.php @@ -16,7 +16,7 @@ */ final class Zephir { - const VERSION = '0.12.1-$Id$'; + const VERSION = '0.12.2-$Id$'; const RELEASE_DATE = '$release-date$'; diff --git a/appveyor.yml b/appveyor.yml index 5d03ef9d33..544c310136 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: 0.12.1-{build} +version: 0.12.2-{build} environment: matrix: From 3ab08da72b21463608e99505d72098328f542cd2 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Fri, 2 Aug 2019 22:12:13 +0300 Subject: [PATCH 02/38] Refactor and cleaned up CI scripts [skip appveyor] --- .ci/after-failure.sh | 30 ++++++++++---- .ci/after-success.sh | 62 ---------------------------- .ci/build-phar.sh | 24 +++++------ .ci/build-test-ext.sh | 68 ++++++++---------------------- .ci/install-prereqs.sh | 25 ++++++----- .ci/install-re2c.sh | 78 ++++++++++++++++++----------------- .ci/memcheck.sh | 16 ++++--- .ci/run-tests.sh | 12 ++---- .travis.yml | 94 ++++++++++++++++++++---------------------- 9 files changed, 157 insertions(+), 252 deletions(-) delete mode 100755 .ci/after-success.sh diff --git a/.ci/after-failure.sh b/.ci/after-failure.sh index bb5a3ea54a..9c41abefc9 100755 --- a/.ci/after-failure.sh +++ b/.ci/after-failure.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # This file is part of the Zephir. # @@ -15,9 +15,28 @@ shopt -s nullglob export LC_ALL=C -for i in /tmp/core.*; do - if [ -f "$i" -a "$(file "$i" | grep -o 'core file')" ]; then - gdb -q $(phpenv which php) "$i" <&1 echo "Compiler log:") + (>&1 printf "%s\\n" "$log_contents") + } +fi + +# for some reason Ubuntu 18.04 on Travis CI doesn't install gdb +function install_gcc() { + if [ "${CI}" = "true" ] && [ "$(command -v gdb 2>/dev/null)" = "" ] + then + (>&1 echo "Install gdb...") + sudo apt-get install --no-install-recommends --quiet --assume-yes gdb 1> /dev/null + fi +} + +for i in /tmp/core.php.*; do + install_gcc + (>&1 printf "Found core dump file: %s\\n\\n" "$i") + gdb -q "$(phpenv which php)" "$i" < -# -# For the full copyright and license information, please view -# the LICENSE file that was distributed with this source code. - -# -e Exit immediately if a command exits with a non-zero status. -# -u Treat unset variables as an error when substituting. -set -eu - -project_root=$(readlink -enq "$(dirname $0)/../") - -gcov_report=${project_root}/unit-tests/output/lcov.info -phpunit_report=${project_root}/unit-tests/output/clover.xml - -if [ -z ${COLLECT_COVERAGE+x} ] || [ "$COLLECT_COVERAGE" != "true" ]; then - printf "Uploading coverage data is not enabled.\nSkip uploading reports to Codecov.\n" - exit 0 -fi - -if [ $(command -v lcov 2>/dev/null) = "" ]; then - printf "lcov does not exist.\nSkip capturing coverage data.\n" -else - # Capture coverage data - lcov \ - --quiet \ - --no-checksum \ - --directory ext \ - --base-directory=${project_root} \ - --capture \ - --compat-libtool \ - --output-file ${gcov_report} 2>/dev/null - - # Remove files matching non-project patterns - lcov \ - --quiet \ - --remove ${gcov_report} "/usr*" \ - --remove ${gcov_report} "${HOME}/.phpenv/*" \ - --compat-libtool \ - --output-file ${gcov_report} 2>/dev/null - - # FIXME: Fix the report - # Cannot open source file ${PROJECT_ROOT}/kernel/fcall.h - sed -i.bak s_${project_root}/kernel_${project_root}/ext/kernel_g ${gcov_report} -fi - -# Note: to upload a coverage report, set the CODECOV_TOKEN environment variable -# export CODECOV_TOKEN= - -curl -sSl https://codecov.io/bash -o "${HOME}/bin/codecov" -chmod +x "${HOME}/bin/codecov" - -if [ -f ${gcov_report} ]; then - codecov -f ${gcov_report} -fi - -if [ -f ${phpunit_report} ]; then - codecov -f ${phpunit_report} -fi diff --git a/.ci/build-phar.sh b/.ci/build-phar.sh index 4de28b6001..fff2792ca2 100755 --- a/.ci/build-phar.sh +++ b/.ci/build-phar.sh @@ -11,24 +11,20 @@ # -u Treat unset variables as an error when substituting. set -eu -project_root=$(readlink -enq "$(dirname $0)/../") - -if [ $(command -v box 2>/dev/null) = "" ]; then - >&2 printf "To use this script you need to install humbug/box.\n" - >&2 printf "You can learn all about humbug/box on https://github.com/humbug/box.\n" - >&2 printf "Aborting.\n" +if [ "$(command -v box 2>/dev/null)" = "" ]; then + (>&2 printf "To use this script you need to install humbug/box: %s \\n" \ + "https://github.com/humbug/box") + (>&2 echo "Aborting.") exit 1 fi -box compile --working-dir=${project_root} +box compile -if [ ! -f "${project_root}/zephir.phar" ] || [ ! -x "${project_root}/zephir.phar" ]; then - >&2 printf "Something went wrong when building Zephir.\n" - >&2 printf "Aborting.\n" +if [ ! -f "./zephir.phar" ] || [ ! -x "./zephir.phar" ]; then + (>&2 echo "Something went wrong when building zephir.phar") + (>&2 echo "Aborting.") exit 1 fi -mkdir -p ${HOME}/bin -rm -f ${HOME}/bin/zephir - -ln -s "${project_root}/zephir.phar" ${HOME}/bin/zephir +mkdir -p "$HOME/bin" +mv "./zephir.phar" "$HOME/bin/zephir" diff --git a/.ci/build-test-ext.sh b/.ci/build-test-ext.sh index 7a2fcc4145..e4724b35dc 100755 --- a/.ci/build-test-ext.sh +++ b/.ci/build-test-ext.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # # This file is part of the Zephir. # @@ -14,35 +14,32 @@ set -eu # This allows the configuration of the executable path as follows: # ZEPHIR_BIN=zephir.phar .ci/build-test-ext.sh # ZEPHIR_BIN=./zephir .ci/build-test-ext.sh -: ${ZEPHIR_BIN:=zephir} +: "${ZEPHIR_BIN:=zephir}" -project_root=$(readlink -enq "$(dirname $0)/../") -gcov_report=${project_root}/unit-tests/output/lcov.info - -alias zephir="${ZEPHIR_BIN}" - -zephir clean 2>&1 || exit 1 -zephir fullclean 2>&1 || exit 1 +$ZEPHIR_BIN clean 2>&1 || exit 1 +$ZEPHIR_BIN fullclean 2>&1 || exit 1 # TODO: Export ZFLAGS and process by Config class ZFLAGS="" # ZFLAGS="${ZFLAGS} -Wnonexistent-function -Wnonexistent-class -Wunused-variable -Wnonexistent-constant" # ZFLAGS="${ZFLAGS} -Wunreachable-code -Wnot-supported-magic-constant -Wnon-valid-decrement" -zephir generate ${ZFLAGS} 2>&1 || exit 1 -zephir stubs ${ZFLAGS} 2>&1 || exit 1 -zephir api ${ZFLAGS} 2>&1 || exit 1 +$ZEPHIR_BIN generate "$ZFLAGS" 2>&1 || exit 1 +$ZEPHIR_BIN stubs "$ZFLAGS" 2>&1 || exit 1 +$ZEPHIR_BIN api "$ZFLAGS" 2>&1 || exit 1 -cd ext +cd ext || exit 1 phpize -if [ ! -z ${COLLECT_COVERAGE+x} ] && [ "$COLLECT_COVERAGE" = "true" ]; then +if [ "$REPORT_COVERAGE" -eq 1 ] +then # The ltmain.sh which bundled with PHP it's from libtool 1.5.26. # However, the version of libtool that claims to no longer remove # ".gcno" profiler information is libtool 2.2.6. The fix is probably # in later libtool versions as well. - if [ "$(uname -s 2>/dev/null)" = "Darwin" ]; then + if [ "$(uname -s 2>/dev/null)" = "Darwin" ] + then # macOS libtoolize_bin=$(command -v glibtoolize 2>/dev/null) else @@ -52,51 +49,22 @@ if [ ! -z ${COLLECT_COVERAGE+x} ] && [ "$COLLECT_COVERAGE" = "true" ]; then aclocal && ${libtoolize_bin} --copy --force && autoheader && autoconf - CFLAGS=`echo "${CFLAGS}" | sed -e 's/-O[0-9s]*//g'` - CXXFLAGS=`echo "${CXXFLAGS}" | sed -e 's/-O[0-9s]*//g'` - LDFLAGS=`echo "${LDFLAGS}" | sed -e 's/--coverage//g'` + CFLAGS=${CFLAGS//-O[0-9s]/} + CXXFLAGS=${CXXFLAGS//-O[0-9s]/} + LDFLAGS=${LDFLAGS//--coverage/} LDFLAGS="${LDFLAGS} --coverage" CFLAGS="${CFLAGS} -O0 -ggdb -fprofile-arcs -ftest-coverage" CXXFLAGS="${CXXFLAGS} -O0 -ggdb -fprofile-arcs -ftest-coverage" fi -if [ ! -z ${CFLAGS+x} ] && [ ! -z ${LDFLAGS+x} ]; then +if [ -n "$CFLAGS" ] && [ -n "$LDFLAGS" ] +then ./configure --enable-test CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" else ./configure --enable-test fi -make -j"$(getconf _NPROCESSORS_ONLN)" - -cd .. - -if [ ! -z ${COLLECT_COVERAGE+x} ] && [ "$COLLECT_COVERAGE" = "true" ]; then - if [ $(command -v lcov 2>/dev/null) = "" ]; then - printf "lcov does not exist.\nSkip capturing coverage data.\n" - else - # Reset all execution counts to zero - lcov \ - --quiet \ - --directory ext \ - --base-directory=${project_root} \ - --zerocounters 2>/dev/null - - # Capture coverage data - lcov \ - --quiet \ - --directory ext \ - --base-directory=${project_root} \ - --capture \ - --compat-libtool \ - --initial \ - --output-file ${gcov_report} 2>/dev/null - - # FIXME: Fix the report - # geninfo: WARNING: could not open ${PROJECT_ROOT}/kernel/fcall.h - # geninfo: WARNING: some exclusion markers may be ignored - sed -i.bak s_${project_root}/kernel_${project_root}/ext/kernel_g ${gcov_report} - fi -fi +make -j"$(getconf _NPROCESSORS_ONLN)" 2> ./compile-errors.log exit $? diff --git a/.ci/install-prereqs.sh b/.ci/install-prereqs.sh index 649720a498..aeb41f3804 100755 --- a/.ci/install-prereqs.sh +++ b/.ci/install-prereqs.sh @@ -12,35 +12,34 @@ set -eu # Ensure that this is being run inside a CI container -if [ "${CI}" != "true" ]; +if [ "${CI}" != "true" ] then - >&2 echo "This script is designed to run inside a CI container only." - >&2 echo "Aborting." + (>&2 echo "This script is designed to run inside a CI container only.") + (>&2 echo "Aborting.") exit 1 fi -PHP_INI="$(phpenv root)/versions/$(phpenv version-name)/etc/php.ini" - -: ${ZEPHIR_PARSER_VERSION:=master} +: "${ZEPHIR_PARSER_VERSION:=master}" # Install psr extension -printf "Install psr extension\n" -printf "\n" | pecl install --force psr 1> /dev/null +(>&1 echo "Install psr extension...") +printf "\\n" | pecl install --force psr 1> /dev/null # Install Zephir Parser -printf "Install Zephir Parser\n" +(>&1 echo "Install Zephir Parser...") git clone -b "${ZEPHIR_PARSER_VERSION}" --depth 1 -q https://github.com/phalcon/php-zephir-parser cd php-zephir-parser +# shellcheck disable=SC2091 $(phpenv which phpize) -./configure --silent --with-php-config=$(phpenv which php-config) --enable-zephir_parser +./configure --silent --with-php-config="$(phpenv which php-config)" --enable-zephir_parser make --silent -j"$(getconf _NPROCESSORS_ONLN)" make --silent install echo 'extension="zephir_parser.so"' > "$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/zephir_parser.ini" # Install Box -if [ "$BUILD_PHAR" = "true" ]; then - printf "Install Box\n" - printf "PHP version number is ${PHP_VERNUM}\nDownloading humbug/box...\n" +if [ "$BUILD_PHAR" = "true" ] +then + (>&1 echo "Install Box...") wget \ "https://github.com/humbug/box/releases/download/${BOX_VERSION}/box.phar" \ --quiet \ diff --git a/.ci/install-re2c.sh b/.ci/install-re2c.sh index 54dc6f8dc4..328466a6e0 100755 --- a/.ci/install-re2c.sh +++ b/.ci/install-re2c.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/usr/bin/env bash # # This file is part of the Zephir. # @@ -7,22 +7,17 @@ # For the full copyright and license information, please view # the LICENSE file that was distributed with this source code. -# -e Exit immediately if a command exits with a non-zero status. -# -u Treat unset variables as an error when substituting. -set -eu - -if [ -z ${CI+x} ] || [ "$CI" != "true" ]; then - >&2 printf "This script is designed to run inside a CI container only.\nAborting.\n" +if [ -z ${RE2C_VERSION+x} ] +then + (>&2 echo "The RE2C_VERSION is unset.") + (>&2 echo "Aborting.") exit 1 fi -if [ -z ${RE2C_VERSION+x} ]; then - >&2 printf "The RE2C_VERSION is unset.\nAborting.\n" - exit 1 -fi - -if [ "${RE2C_VERSION}" = "system" ]; then - printf "Use system re2c.\nSkip.\n" +if [ "${RE2C_VERSION}" == "system" ] +then + (>&2 echo "Use system re2c.") + (>&2 echo "Skip.") exit 0 fi @@ -32,53 +27,60 @@ downloaddir="${HOME}/.cache/${pkgname}/${pkgname}-${RE2C_VERSION}" prefix="${HOME}/.local/opt/${pkgname}/${pkgname}-${RE2C_VERSION}" bindir="${prefix}/bin" -if [ ! -f "${bindir}/re2c" ]; then - if [ ! -d `dirname ${downloaddir}` ]; then - mkdir -p `dirname ${downloaddir}` +if [ ! -f "${bindir}/re2c" ] +then + if [ ! -d "$(dirname "$downloaddir")" ] + then + mkdir -p "$(dirname "$downloaddir")" fi - cd `dirname ${downloaddir}` + cd "$(dirname "$downloaddir")" || exit 1 - if [ ! -f "${pkgname}-${RE2C_VERSION}.tar.gz" ]; then + if [ ! -f "${pkgname}-${RE2C_VERSION}.tar.gz" ] + then curl -sSL "$source" -o "${pkgname}-${RE2C_VERSION}.tar.gz" fi - if [ ! -f "${pkgname}-${RE2C_VERSION}.tar.gz" ]; then - >&2 printf "Aborting.\n" - >&2 printf "Unable to locate ${pkgname}-${RE2C_VERSION}.tar.gz file.\n" + if [ ! -f "${pkgname}-${RE2C_VERSION}.tar.gz" ] + then + (>&2 printf "Unable to locate %s-%s .tar.gz file.\\n" "$pkgname" "$RE2C_VERSION") + (>&2 echo "Stop.") exit 1 fi - if [ ! -d "${downloaddir}" ]; then - mkdir -p "${downloaddir}" + if [ ! -d "$downloaddir" ] + then + mkdir -p "$downloaddir" tar -zxf "${pkgname}-${RE2C_VERSION}.tar.gz" fi - if [ ! -d "${downloaddir}" ]; then - >&2 printf "Unable to locate re2c source.\nAborting.\n" + if [ ! -d "$downloaddir" ] + then + (>&2 echo "Unable to locate re2c source.") + (>&2 echo "Stop.") exit 1 fi - if [ ! -d "${prefix}" ]; then - mkdir -p "${prefix}" + if [ ! -d "$prefix" ] + then + mkdir -p "$prefix" fi - cd "${downloaddir}" - ./configure --prefix="${prefix}" + cd "$downloaddir" || exit 1 + ./configure --silent --prefix="${prefix}" - make -j"$(getconf _NPROCESSORS_ONLN)" - make install + make --silent -j"$(getconf _NPROCESSORS_ONLN)" + make --silent install fi -if [ ! -x "${bindir}/re2c" ]; then - >&2 printf "Unable to locate re2c executable.\nAborting.\n" +if [ ! -x "$bindir/re2c" ]; then + (>&2 echo "Unable to locate re2c executable.") + (>&2 echo "Stop.") exit 1 fi -cd ${TRAVIS_BUILD_DIR} - -mkdir -p ${HOME}/bin -ln -s "${bindir}/re2c" ${HOME}/bin/re2c +mkdir -p "$HOME/bin" +ln -s "$bindir/re2c" "$HOME/bin/re2c" re2c --version exit 0 diff --git a/.ci/memcheck.sh b/.ci/memcheck.sh index 351e6d4684..3ce12874d3 100755 --- a/.ci/memcheck.sh +++ b/.ci/memcheck.sh @@ -7,9 +7,9 @@ # For the full copyright and license information, please view # the LICENSE file that was distributed with this source code. -if [ $(command -v valgrind 2>/dev/null) = "" ]; then - >&2 printf "Valgring does not exist. Can not check for memory leaks.\n" - >&2 printf "Aborting.\n" +if [ "$(command -v valgrind 2>/dev/null)" = "" ]; then + (>&2 echo "Valgring does not exist. Can not check for memory leaks.") + (>&2 echo "Aborting.") exit 1 fi @@ -22,9 +22,7 @@ export USE_ZEND_ALLOC=0 # Do not stop testing on failures export PHPUNIT_DONT_EXIT=1 -project_root=$(readlink -enq "$(dirname $0)/../") - -valgrind +valgrind \ --read-var-info=yes \ --error-exitcode=1 \ --fullpath-after= \ @@ -32,8 +30,8 @@ valgrind --leak-check=full \ --num-callers=20 \ --run-libc-freeres=no \ - $(phpenv which php) - -d "extension=${project_root}/ext/modules/test.so" \ - "${project_root}/unit-tests/phpunit" \ + "$(phpenv which php)" \ + -d "extension=ext/modules/test.so" \ + "unit-tests/phpunit" \ --no-coverage \ --testsuite "Extension Test Suite" diff --git a/.ci/run-tests.sh b/.ci/run-tests.sh index eea50dccea..4002eb6d0d 100755 --- a/.ci/run-tests.sh +++ b/.ci/run-tests.sh @@ -11,26 +11,20 @@ # -u Treat unset variables as an error when substituting. set -eu -if [ -z ${CI+x} ] || [ "$CI" != "true" ]; then - >&2 printf "This script is designed to run inside a CI container only.\n" - >&2 printf "Aborting.\n" - exit 1 -fi - -if [ "$(php-config --vernum)" -lt "70200" ]; then +if [ "$($(phpenv which php-config) --vernum)" -lt "70200" ]; then test_suite="Extension_Php70" else test_suite="Extension_Php72" fi -php \ +"$(phpenv which php)" \ -d extension=ext/modules/test.so \ vendor/bin/simple-phpunit \ --colors=always \ --bootstrap unit-tests/ext-bootstrap.php \ --testsuite ${test_suite} -php \ +"$(phpenv which php)" \ vendor/bin/simple-phpunit \ --colors=always \ --testsuite Zephir diff --git a/.travis.yml b/.travis.yml index 3e258737f4..f8756452a6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,8 @@ php: - '7.1' - '7.0' +dist: bionic + git: depth: 5 quiet: true @@ -14,7 +16,7 @@ addons: apt: packages: - gdb - - lcov + - shellcheck matrix: fast_finish: true @@ -32,50 +34,48 @@ cache: env: global: - RE2C_VERSION="1.1.1" - - ZEPHIR_PARSER_VERSION="v1.3.0" + - ZEPHIR_PARSER_VERSION="v1.3.1" # TODO: See Library/StatementsBlock.php # - ZEPHIR_DEBUG=true - - COLLECT_COVERAGE=true + - REPORT_COVERAGE=1 - BOX_VERSION=3.3.1 - - BUILD_PHAR=false + - BUILD_PHAR=0 - PATH="${HOME}/bin:${PATH}" - TRAVIS_COMMIT_LOG=`git log --format=fuller -5` before_install: - | - # General settings - stty cols 120 + # Core dump settings + ulimit -c unlimited -S || true + echo '/tmp/core.%e.%p.%t' | sudo tee /proc/sys/kernel/core_pattern - # Export build/test environment variables - export SYMFONY_PHPUNIT_DIR=$(pwd)/.phpunit - export PHP_VERNUM="$(php-config --vernum)" + if [ ! -z "${GITHUB_TOKEN}" ]; then + composer config github-oauth.github.com ${GITHUB_TOKEN} + printf "Add Github token\n" + fi - if [ ! -z "${GITHUB_TOKEN}" ]; then - composer config github-oauth.github.com ${GITHUB_TOKEN} - printf "Add Github token\n" - fi + # Export build/test environment variables + export SYMFONY_PHPUNIT_DIR=$(pwd)/.phpunit + export PHP_VERNUM="$(php-config --vernum)" - [ -d ~/bin ] || mkdir ~/bin + [ -d ~/bin ] || mkdir ~/bin - # Core dump settings - ulimit -c unlimited -S || true - echo '/tmp/core.%e.%p.%t' | sudo tee /proc/sys/kernel/core_pattern + # Hide "You are in 'detached HEAD' state" message + git config --global advice.detachedHead false - # Hide "You are in 'detached HEAD' state" message - git config --global advice.detachedHead false + # Box does not work with PHP 7.4 + if [ "$PHP_VERNUM" -ge "70100" ] && [ "$PHP_VERNUM" -lt "70400" ]; then + export BUILD_PHAR=1 + fi - # Box does not work with PHP 7.4 - if [ "$PHP_VERNUM" -ge "70100" ] && [ "$PHP_VERNUM" -lt "70400" ]; then - export BUILD_PHAR=true - fi + if [ "$PHP_VERNUM" -ge "70400" ]; then + # Do not collect code coverage for PHP 7.4 + export REPORT_COVERAGE=0 - if [ "$PHP_VERNUM" -ge "70400" ]; then - # Do not collect code coverage for PHP 7.4 - export COLLECT_COVERAGE=false + # Temporary until we release parser with PHP 7.4 support + export ZEPHIR_PARSER_VERSION=development + fi - # Temporary until we release parser with PHP 7.4 support - export ZEPHIR_PARSER_VERSION=development - fi install: - .ci/install-prereqs.sh - .ci/install-re2c.sh $RE2C_VERSION @@ -84,7 +84,7 @@ install: - travis_retry composer install $flags - | # Prepare Zephir executable - if [ "$BUILD_PHAR" = "true" ]; then + if [ "$BUILD_PHAR" -eq 1 ]; then printf "Build Zephit PHAR\n" .ci/build-phar.sh else @@ -103,37 +103,22 @@ script: - .ci/run-tests.sh - (cd unit-tests/sharness && make) -after_success: - - .ci/after-success.sh - -after_failure: - - .ci/after-failure.sh - jobs: include: - stage: Static Code Analysis - php: 7.2 + php: '7.2' env: - - CHECK=php-cs-fixer - - COLLECT_COVERAGE=false + - REPORT_COVERAGE=0 install: - wget --no-clobber -O $HOME/bin/php-cs-fixer https://cs.sensiolabs.org/download/php-cs-fixer-v2.phar - before_script: - - chmod +x $HOME/bin/php-cs-fixer - script: - - php-cs-fixer fix --diff --dry-run -v - - - stage: Static Code Analysis - php: 7.2 - env: - - CHECK=PHP_CodeSniffer - - COLLECT_COVERAGE=false - install: - wget --no-clobber -O $HOME/bin/phpcs https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar before_script: + - chmod +x $HOME/bin/php-cs-fixer - chmod +x $HOME/bin/phpcs script: - phpcs + - php-cs-fixer fix --diff --dry-run -v + - shellcheck .ci/*.sh notifications: email: false @@ -142,6 +127,15 @@ after_script: - printf "$TRAVIS_COMMIT_RANGE\n" - printf "$TRAVIS_COMMIT_LOG\n" +after_success: + - .ci/after-success.sh + - '[[ "$REPORT_COVERAGE" -eq 1 ]] && bash <(curl -s https://codecov.io/bash)' + +after_failure: + - $(phpenv which php) -v + - $(phpenv which php) -m + - .ci/after-failure.sh + before_deploy: - git config --global user.name cicdbot - git config --global user.email team@zephir-lang.com From c70c30690547d455141bc341aa694bebd7c2aa56 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Fri, 2 Aug 2019 22:41:52 +0300 Subject: [PATCH 03/38] Correct CI scripts and fix code style [skip appveyor] --- .ci/install-prereqs.sh | 5 ++-- .travis.yml | 52 ++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/.ci/install-prereqs.sh b/.ci/install-prereqs.sh index aeb41f3804..f1302e7553 100755 --- a/.ci/install-prereqs.sh +++ b/.ci/install-prereqs.sh @@ -27,7 +27,7 @@ printf "\\n" | pecl install --force psr 1> /dev/null # Install Zephir Parser (>&1 echo "Install Zephir Parser...") -git clone -b "${ZEPHIR_PARSER_VERSION}" --depth 1 -q https://github.com/phalcon/php-zephir-parser +git clone -b "$ZEPHIR_PARSER_VERSION" --depth 1 -q https://github.com/phalcon/php-zephir-parser cd php-zephir-parser # shellcheck disable=SC2091 $(phpenv which phpize) @@ -37,7 +37,7 @@ make --silent install echo 'extension="zephir_parser.so"' > "$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/zephir_parser.ini" # Install Box -if [ "$BUILD_PHAR" = "true" ] +if [ "$BUILD_PHAR" -eq "1" ] then (>&1 echo "Install Box...") wget \ @@ -46,6 +46,5 @@ then -O "${HOME}/bin/box" chmod +x "${HOME}/bin/box" - box --version fi diff --git a/.travis.yml b/.travis.yml index f8756452a6..dc46c0f7c3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,8 @@ env: - BOX_VERSION=3.3.1 - BUILD_PHAR=0 - PATH="${HOME}/bin:${PATH}" - - TRAVIS_COMMIT_LOG=`git log --format=fuller -5` + - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest" + - TRAVIS_COMMIT_LOG="$(git log --format=fuller -5)" before_install: - | @@ -49,13 +50,13 @@ before_install: ulimit -c unlimited -S || true echo '/tmp/core.%e.%p.%t' | sudo tee /proc/sys/kernel/core_pattern - if [ ! -z "${GITHUB_TOKEN}" ]; then - composer config github-oauth.github.com ${GITHUB_TOKEN} - printf "Add Github token\n" + if [ -n "$GITHUB_TOKEN" ]; then + composer config github-oauth.github.com "$GITHUB_TOKEN" + echo 'Add Github token' fi # Export build/test environment variables - export SYMFONY_PHPUNIT_DIR=$(pwd)/.phpunit + export SYMFONY_PHPUNIT_DIR="$(pwd)/.phpunit" export PHP_VERNUM="$(php-config --vernum)" [ -d ~/bin ] || mkdir ~/bin @@ -64,11 +65,13 @@ before_install: git config --global advice.detachedHead false # Box does not work with PHP 7.4 - if [ "$PHP_VERNUM" -ge "70100" ] && [ "$PHP_VERNUM" -lt "70400" ]; then + if [ "$PHP_VERNUM" -ge "70100" ] && [ "$PHP_VERNUM" -lt "70400" ] + then export BUILD_PHAR=1 fi - if [ "$PHP_VERNUM" -ge "70400" ]; then + if [ "$PHP_VERNUM" -ge "70400" ] + then # Do not collect code coverage for PHP 7.4 export REPORT_COVERAGE=0 @@ -76,25 +79,30 @@ before_install: export ZEPHIR_PARSER_VERSION=development fi + if [ "$TRAVIS_PHP_VERSION" = "7.2" ] + then + echo 'Choose a suitable PHP version to build PHAR' + composer config platform.php 7.0.33 + fi + install: - .ci/install-prereqs.sh - - .ci/install-re2c.sh $RE2C_VERSION - - flags="--ansi --prefer-dist --no-interaction --optimize-autoloader --no-suggest --no-progress" - - if [ "$TRAVIS_PHP_VERSION" = "7.2" ]; then composer config platform.php 7.0.33; echo "Preparing to deploy"; fi - - travis_retry composer install $flags + - .ci/install-re2c.sh "$RE2C_VERSION" + - travis_retry composer install "$DEFAULT_COMPOSER_FLAGS" - | # Prepare Zephir executable - if [ "$BUILD_PHAR" -eq 1 ]; then - printf "Build Zephit PHAR\n" + if [ "$BUILD_PHAR" -eq 1 ] + then + echo "Build Zephit PHAR" .ci/build-phar.sh else - printf "Use Zephir from source\n" - ln -s $(pwd)/zephir ${HOME}/bin/zephir + echo "Use Zephir from source" + ln -s "$(pwd)/zephir" "$HOME/bin/zephir" fi before_script: - .ci/build-test-ext.sh - - cat .ci/travis.ini >> $(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/travis.ini + - cat .ci/travis.ini >> "$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/travis.ini" # Does not ready yet - if [ "$PHP_VERNUM" -ge "70400" ]; then phpenv config-rm xdebug.ini || true; fi @@ -110,11 +118,11 @@ jobs: env: - REPORT_COVERAGE=0 install: - - wget --no-clobber -O $HOME/bin/php-cs-fixer https://cs.sensiolabs.org/download/php-cs-fixer-v2.phar - - wget --no-clobber -O $HOME/bin/phpcs https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar + - wget --quiet -O "$HOME/bin/php-cs-fixer" https://cs.sensiolabs.org/download/php-cs-fixer-v2.phar + - wget --quiet -O "$HOME/bin/phpcs" https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar before_script: - - chmod +x $HOME/bin/php-cs-fixer - - chmod +x $HOME/bin/phpcs + - chmod +x "$HOME/bin/php-cs-fixer" + - chmod +x "$HOME/bin/phpcs" script: - phpcs - php-cs-fixer fix --diff --dry-run -v @@ -132,8 +140,8 @@ after_success: - '[[ "$REPORT_COVERAGE" -eq 1 ]] && bash <(curl -s https://codecov.io/bash)' after_failure: - - $(phpenv which php) -v - - $(phpenv which php) -m + - "$(phpenv which php)" -v + - "$(phpenv which php)" -m - .ci/after-failure.sh before_deploy: From 458e1dc220a7cc164735622eefcf0e72e45ff3a1 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Fri, 2 Aug 2019 22:46:20 +0300 Subject: [PATCH 04/38] Fixed Travis config [skip appveyor] --- .travis.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index dc46c0f7c3..8994b0ab6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -50,7 +50,8 @@ before_install: ulimit -c unlimited -S || true echo '/tmp/core.%e.%p.%t' | sudo tee /proc/sys/kernel/core_pattern - if [ -n "$GITHUB_TOKEN" ]; then + if [ -n "$GITHUB_TOKEN" ] + then composer config github-oauth.github.com "$GITHUB_TOKEN" echo 'Add Github token' fi @@ -140,8 +141,8 @@ after_success: - '[[ "$REPORT_COVERAGE" -eq 1 ]] && bash <(curl -s https://codecov.io/bash)' after_failure: - - "$(phpenv which php)" -v - - "$(phpenv which php)" -m + - echo "$($(phpenv which php) -v)" + - echo "$($(phpenv which php) -m)" - .ci/after-failure.sh before_deploy: From 07ae075608e8e4ead5bf7847f6b66f8162db2280 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Fri, 2 Aug 2019 23:06:34 +0300 Subject: [PATCH 05/38] Fixed composer flags [skip appveyor] --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8994b0ab6c..74893389b5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,7 @@ env: - BOX_VERSION=3.3.1 - BUILD_PHAR=0 - PATH="${HOME}/bin:${PATH}" - - DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest" + - DEFAULT_COMPOSER_FLAGS=(--no-interaction --no-ansi --no-progress --no-suggest) - TRAVIS_COMMIT_LOG="$(git log --format=fuller -5)" before_install: @@ -89,7 +89,7 @@ before_install: install: - .ci/install-prereqs.sh - .ci/install-re2c.sh "$RE2C_VERSION" - - travis_retry composer install "$DEFAULT_COMPOSER_FLAGS" + - travis_retry composer install ${DEFAULT_COMPOSER_FLAGS[*]} - | # Prepare Zephir executable if [ "$BUILD_PHAR" -eq 1 ] From 188d8ef44a6e72f94ec0266c483bfa9f102db779 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Fri, 2 Aug 2019 23:24:21 +0300 Subject: [PATCH 06/38] Fixed build script [skip appveyor] --- .ci/build-test-ext.sh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.ci/build-test-ext.sh b/.ci/build-test-ext.sh index e4724b35dc..7a4a11ef62 100755 --- a/.ci/build-test-ext.sh +++ b/.ci/build-test-ext.sh @@ -16,6 +16,12 @@ set -eu # ZEPHIR_BIN=./zephir .ci/build-test-ext.sh : "${ZEPHIR_BIN:=zephir}" +# Some defaults +: "${REPORT_COVERAGE:=0}" +: "${CFLAGS:=}" +: "${CXXFLAGS:=}" +: "${LDFLAGS:=}" + $ZEPHIR_BIN clean 2>&1 || exit 1 $ZEPHIR_BIN fullclean 2>&1 || exit 1 @@ -24,9 +30,9 @@ ZFLAGS="" # ZFLAGS="${ZFLAGS} -Wnonexistent-function -Wnonexistent-class -Wunused-variable -Wnonexistent-constant" # ZFLAGS="${ZFLAGS} -Wunreachable-code -Wnot-supported-magic-constant -Wnon-valid-decrement" -$ZEPHIR_BIN generate "$ZFLAGS" 2>&1 || exit 1 -$ZEPHIR_BIN stubs "$ZFLAGS" 2>&1 || exit 1 -$ZEPHIR_BIN api "$ZFLAGS" 2>&1 || exit 1 +$ZEPHIR_BIN generate ${ZFLAGS} 2>&1 || exit 1 +$ZEPHIR_BIN stubs ${ZFLAGS} 2>&1 || exit 1 +$ZEPHIR_BIN api ${ZFLAGS} 2>&1 || exit 1 cd ext || exit 1 From 0125b423999c5f81b54e4191769819cb5974d41a Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Fri, 2 Aug 2019 23:58:25 +0300 Subject: [PATCH 07/38] Use Xenial at Travis to be able install PHP 7.0 [skip appveyor] --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 74893389b5..099605bf82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ php: - '7.1' - '7.0' -dist: bionic +dist: xenial git: depth: 5 From 25eb4fe17fe26dee5890813a9ede05e636c469f9 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Fri, 2 Aug 2019 23:58:52 +0300 Subject: [PATCH 08/38] Minor cleanup zephir-autocomplete [skip appveyor] --- zephir-autocomplete | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/zephir-autocomplete b/zephir-autocomplete index 43d06afaae..8b21c6153f 100644 --- a/zephir-autocomplete +++ b/zephir-autocomplete @@ -33,18 +33,17 @@ function _zephir_completion() { if [[ $COMP_CWORD -gt 1 ]] then - local prev="${COMP_WORDS[$COMP_CWORD-1]}" local first="${COMP_WORDS[1]}" if [[ "$cur" == -* ]] then - declare -a a_commands=( $( echo $commands | tr " " "\n" ) ) + declare -a a_commands=( "$( echo "$commands" | tr " " "\n" )" ) for i in "${a_commands[@]}" do if [ "$i" = "$first" ] then - local opts=$( zephir $first -h --no-ansi | \ + local opts=$( zephir "$first" -h --no-ansi | \ tr -cs '[=-=][:alpha:]_' '[\n*]' | \ grep '^-' ) COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) From aeaf29d1a1154506cc2e207a314762897a0bf071 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 00:14:30 +0300 Subject: [PATCH 09/38] Full support of PHP 7.4 [skip appveyor] --- .travis.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 099605bf82..9f250fda7f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,16 +66,13 @@ before_install: git config --global advice.detachedHead false # Box does not work with PHP 7.4 - if [ "$PHP_VERNUM" -ge "70100" ] && [ "$PHP_VERNUM" -lt "70400" ] + if [ "$PHP_VERNUM" -ge "70100" ] then export BUILD_PHAR=1 fi if [ "$PHP_VERNUM" -ge "70400" ] then - # Do not collect code coverage for PHP 7.4 - export REPORT_COVERAGE=0 - # Temporary until we release parser with PHP 7.4 support export ZEPHIR_PARSER_VERSION=development fi @@ -104,8 +101,6 @@ install: before_script: - .ci/build-test-ext.sh - cat .ci/travis.ini >> "$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/travis.ini" - # Does not ready yet - - if [ "$PHP_VERNUM" -ge "70400" ]; then phpenv config-rm xdebug.ini || true; fi script: - zephir From 742a4b60e7874c6921d8ccc9a25ef6bd42e1334a Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 00:14:41 +0300 Subject: [PATCH 10/38] Minor cleanup zephir-autocomplete [skip appveyor] --- zephir-autocomplete | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/zephir-autocomplete b/zephir-autocomplete index 8b21c6153f..18c6039da0 100644 --- a/zephir-autocomplete +++ b/zephir-autocomplete @@ -37,13 +37,14 @@ function _zephir_completion() { if [[ "$cur" == -* ]] then - declare -a a_commands=( "$( echo "$commands" | tr " " "\n" )" ) + declare -a a_commands=( "$( echo "$commands" | tr " " "\\n" )" ) for i in "${a_commands[@]}" do if [ "$i" = "$first" ] then - local opts=$( zephir "$first" -h --no-ansi | \ + local opts + opts=$( zephir "$first" -h --no-ansi | \ tr -cs '[=-=][:alpha:]_' '[\n*]' | \ grep '^-' ) COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) @@ -54,7 +55,8 @@ function _zephir_completion() { fi elif [[ "$cur" == -* ]] then - local opts="--help --quiet --verbose --version --ansi --no-ansi" + local opts + opts="--help --quiet --verbose --version --ansi --no-ansi" opts+=" --dumpversion" COMPREPLY=( $( compgen -W "${opts}" -- "${cur}" ) ) From 27a4eccb96233ce4d47a03fd1cc5887a104d8ab6 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 00:47:42 +0300 Subject: [PATCH 11/38] Don ot install humbug/box for PHP 7.4 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 9f250fda7f..32c5ab3150 100644 --- a/.travis.yml +++ b/.travis.yml @@ -66,7 +66,7 @@ before_install: git config --global advice.detachedHead false # Box does not work with PHP 7.4 - if [ "$PHP_VERNUM" -ge "70100" ] + if [ "$PHP_VERNUM" -ge "70100" ] && [ "$PHP_VERNUM" -lt "70400" ] then export BUILD_PHAR=1 fi From a6e971757820716981a1c1f3c9cf9ea9230c9a78 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 00:48:21 +0300 Subject: [PATCH 12/38] Update noNamespaceSchemaLocation for phpcs && phpunit --- phpcs.xml.dist | 2 +- phpunit.xml.dist | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/phpcs.xml.dist b/phpcs.xml.dist index c3fd26d70c..b8a53d6645 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -1,7 +1,7 @@ diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 242e18c383..add9fbd602 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,7 +1,7 @@ Date: Sat, 3 Aug 2019 00:49:06 +0300 Subject: [PATCH 13/38] Remove no longer used constant --- Library/Zephir.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/Library/Zephir.php b/Library/Zephir.php index 6a9056fe16..cb29a73a8c 100644 --- a/Library/Zephir.php +++ b/Library/Zephir.php @@ -18,8 +18,6 @@ final class Zephir { const VERSION = '0.12.2-$Id$'; - const RELEASE_DATE = '$release-date$'; - const LOGO = <<<'ASCII' _____ __ _ /__ / ___ ____ / /_ (_)____ From 18d25717a719b1550b409ce9f8e54735edc3da7a Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 01:09:02 +0300 Subject: [PATCH 14/38] Regenerate ext --- ext/php_test.h | 2 +- ext/test/oo/oodestruct.zep.c | 32 +++++++++++++------------ ext/test/optimizers/strreplace.zep.c | 2 +- ext/test/properties/propertyarray.zep.c | 6 ++--- ext/test/quantum.zep.c | 4 ++-- ext/test/range.zep.c | 4 ++-- ext/test/regexdna.zep.c | 4 ++-- ext/test/requires.zep.c | 2 +- ext/test/requires/external3.zep.c | 4 ++-- ext/test/resourcetest.zep.c | 2 +- ext/test/router.zep.c | 6 ++--- ext/test/scall.zep.c | 8 +++---- ext/test/scope.zep.c | 4 ++-- ext/test/sort.zep.c | 6 ++--- ext/test/spectralnorm.zep.c | 32 ++++++++++++------------- ext/test/strings.zep.c | 8 +++---- ext/test/trytest.zep.c | 12 +++++----- 17 files changed, 70 insertions(+), 68 deletions(-) diff --git a/ext/php_test.h b/ext/php_test.h index ca84bac924..f56b06d665 100644 --- a/ext/php_test.h +++ b/ext/php_test.h @@ -14,7 +14,7 @@ #define PHP_TEST_VERSION "1.0.0" #define PHP_TEST_EXTNAME "test" #define PHP_TEST_AUTHOR "Zephir Team and contributors" -#define PHP_TEST_ZEPVERSION "0.12.1-$Id$" +#define PHP_TEST_ZEPVERSION "0.12.2-$Id$" #define PHP_TEST_DESCRIPTION "Description test for
Test Extension." typedef struct _zephir_struct_db { diff --git a/ext/test/oo/oodestruct.zep.c b/ext/test/oo/oodestruct.zep.c index 5caf6f93be..d99776b38e 100644 --- a/ext/test/oo/oodestruct.zep.c +++ b/ext/test/oo/oodestruct.zep.c @@ -160,9 +160,8 @@ PHP_METHOD(Test_Oo_OoDestruct, __construct) { zend_bool _30$$13; zend_class_entry *_26$$11 = NULL, *_22$$12 = NULL, *_32$$14 = NULL; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; - zephir_fcall_cache_entry *_29 = NULL; zend_long width, height, ZEPHIR_LAST_CALL_STATUS; - zval *file_param = NULL, *width_param = NULL, *height_param = NULL, __$true, imageinfo, _0, _1, _2$$4, _3$$4, _4$$4, _9$$4, _28$$4, _5$$5, _6$$5, _7$$5, _8$$5, _10$$6, _11$$6, _12$$7, _13$$7, _14$$8, _15$$8, _16$$9, _17$$9, _18$$10, _19$$10, _20$$11, _25$$11, _27$$11, _21$$12, _23$$12, _24$$12, _35$$13, _36$$13, _37$$13, _38$$13, _39$$13, _40$$13, _31$$14, _33$$14, _34$$14; + zval *file_param = NULL, *width_param = NULL, *height_param = NULL, __$true, imageinfo, _0, _1, _2$$4, _3$$4, _4$$4, _9$$4, _28$$4, _29$$4, _5$$5, _6$$5, _7$$5, _8$$5, _10$$6, _11$$6, _12$$7, _13$$7, _14$$8, _15$$8, _16$$9, _17$$9, _18$$10, _19$$10, _20$$11, _25$$11, _27$$11, _21$$12, _23$$12, _24$$12, _35$$13, _36$$13, _37$$13, _38$$13, _39$$13, _40$$13, _31$$14, _33$$14, _34$$14; zval file; zval *this_ptr = getThis(); @@ -176,6 +175,7 @@ PHP_METHOD(Test_Oo_OoDestruct, __construct) { ZVAL_UNDEF(&_4$$4); ZVAL_UNDEF(&_9$$4); ZVAL_UNDEF(&_28$$4); + ZVAL_UNDEF(&_29$$4); ZVAL_UNDEF(&_5$$5); ZVAL_UNDEF(&_6$$5); ZVAL_UNDEF(&_7$$5); @@ -260,35 +260,35 @@ PHP_METHOD(Test_Oo_OoDestruct, __construct) { do { if (ZEPHIR_IS_LONG(&_9$$4, 1)) { zephir_read_property(&_10$$6, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_11$$6, "imagecreatefromgif", NULL, 59, &_10$$6); + ZEPHIR_CALL_FUNCTION(&_11$$6, "imagecreatefromgif", NULL, 0, &_10$$6); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_11$$6); break; } if (ZEPHIR_IS_LONG(&_9$$4, 2)) { zephir_read_property(&_12$$7, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_13$$7, "imagecreatefromjpeg", NULL, 60, &_12$$7); + ZEPHIR_CALL_FUNCTION(&_13$$7, "imagecreatefromjpeg", NULL, 0, &_12$$7); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_13$$7); break; } if (ZEPHIR_IS_LONG(&_9$$4, 3)) { zephir_read_property(&_14$$8, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_15$$8, "imagecreatefrompng", NULL, 61, &_14$$8); + ZEPHIR_CALL_FUNCTION(&_15$$8, "imagecreatefrompng", NULL, 0, &_14$$8); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_15$$8); break; } if (ZEPHIR_IS_LONG(&_9$$4, 15)) { zephir_read_property(&_16$$9, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_17$$9, "imagecreatefromwbmp", NULL, 62, &_16$$9); + ZEPHIR_CALL_FUNCTION(&_17$$9, "imagecreatefromwbmp", NULL, 0, &_16$$9); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_17$$9); break; } if (ZEPHIR_IS_LONG(&_9$$4, 16)) { zephir_read_property(&_18$$10, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_19$$10, "imagecreatefromxbm", NULL, 63, &_18$$10); + ZEPHIR_CALL_FUNCTION(&_19$$10, "imagecreatefromxbm", NULL, 0, &_18$$10); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_19$$10); break; @@ -328,7 +328,8 @@ PHP_METHOD(Test_Oo_OoDestruct, __construct) { } while(0); zephir_read_property(&_28$$4, this_ptr, SL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_29, 64, &_28$$4, &__$true); + ZVAL_BOOL(&_29$$4, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, &_28$$4, &_29$$4); zephir_check_call_status(); } else { _30$$13 = !width; @@ -354,14 +355,15 @@ PHP_METHOD(Test_Oo_OoDestruct, __construct) { } ZVAL_LONG(&_35$$13, width); ZVAL_LONG(&_36$$13, height); - ZEPHIR_CALL_FUNCTION(&_37$$13, "imagecreatetruecolor", NULL, 65, &_35$$13, &_36$$13); + ZEPHIR_CALL_FUNCTION(&_37$$13, "imagecreatetruecolor", NULL, 0, &_35$$13, &_36$$13); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_37$$13); zephir_read_property(&_35$$13, this_ptr, SL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 66, &_35$$13, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 59, &_35$$13, &__$true); zephir_check_call_status(); zephir_read_property(&_36$$13, this_ptr, SL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_29, 64, &_36$$13, &__$true); + ZVAL_BOOL(&_38$$13, 1); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, &_36$$13, &_38$$13); zephir_check_call_status(); zephir_read_property(&_38$$13, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, SL("realpath"), &_38$$13); @@ -398,7 +400,7 @@ PHP_METHOD(Test_Oo_OoDestruct, __destruct) { zephir_read_property(&_0, this_ptr, SL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&image, &_0); if (Z_TYPE_P(&image) == IS_RESOURCE) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 67, &image); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, &image); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -453,7 +455,7 @@ PHP_METHOD(Test_Oo_OoDestruct, check) { ZVAL_STRING(&_4, "2.0.1"); ZEPHIR_INIT_VAR(&_5); ZVAL_STRING(&_5, ">="); - ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 68, &version, &_4, &_5); + ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 60, &version, &_4, &_5); zephir_check_call_status(); if (UNEXPECTED(!zephir_is_true(&_6))) { ZEPHIR_INIT_VAR(&_7$$5); @@ -519,13 +521,13 @@ PHP_METHOD(Test_Oo_OoDestruct, getVersion) { ZVAL_NULL(&version); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "GD_VERSION"); - ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 69, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 61, &_3); zephir_check_call_status(); if (zephir_is_true(&_4)) { ZEPHIR_INIT_NVAR(&version); ZEPHIR_MM_GET_CONSTANT(&version, "GD_VERSION"); } else { - ZEPHIR_CALL_FUNCTION(&info, "gd_info", NULL, 70); + ZEPHIR_CALL_FUNCTION(&info, "gd_info", NULL, 62); zephir_check_call_status(); ZEPHIR_INIT_VAR(&matches); ZVAL_NULL(&matches); diff --git a/ext/test/optimizers/strreplace.zep.c b/ext/test/optimizers/strreplace.zep.c index 55d802bcab..c4f5b8ad9d 100644 --- a/ext/test/optimizers/strreplace.zep.c +++ b/ext/test/optimizers/strreplace.zep.c @@ -209,7 +209,7 @@ PHP_METHOD(Test_Optimizers_StrReplace, issue732B) { zephir_array_fast_append(&replacements, &_0); ZEPHIR_INIT_VAR(&subject); ZVAL_STRING(&subject, "The quick brown fox jumped over the lazy dog."); - ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 71, &patterns, &replacements, &subject); + ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 63, &patterns, &replacements, &subject); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/properties/propertyarray.zep.c b/ext/test/properties/propertyarray.zep.c index 62a76b8be1..e90e065f12 100644 --- a/ext/test/properties/propertyarray.zep.c +++ b/ext/test/properties/propertyarray.zep.c @@ -138,12 +138,12 @@ PHP_METHOD(Test_Properties_PropertyArray, testIssues1831) { } zephir_read_property(&_0$$3, this_ptr, SL("otherArray"), PH_NOISY_CC | PH_READONLY); ZEPHIR_MAKE_REF(&_0$$3); - ZEPHIR_CALL_FUNCTION(&info, "array_shift", &_1, 72, &_0$$3); + ZEPHIR_CALL_FUNCTION(&info, "array_shift", &_1, 64, &_0$$3); ZEPHIR_UNREF(&_0$$3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRING(&_2$$3, "header"); - ZEPHIR_CALL_FUNCTION(&_3$$3, "stripos", &_4, 73, &info, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "stripos", &_4, 65, &info, &_2$$3); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&_3$$3)) { zephir_array_append(&headers, &info, PH_SEPARATE, "test/properties/propertyarray.zep", 51); @@ -151,7 +151,7 @@ PHP_METHOD(Test_Properties_PropertyArray, testIssues1831) { } else { zephir_read_property(&_5$$5, this_ptr, SL("otherArray"), PH_NOISY_CC | PH_READONLY); ZEPHIR_MAKE_REF(&_5$$5); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", &_6, 74, &_5$$5, &info); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", &_6, 66, &_5$$5, &info); ZEPHIR_UNREF(&_5$$5); zephir_check_call_status(); break; diff --git a/ext/test/quantum.zep.c b/ext/test/quantum.zep.c index 69144a6bae..7a6fcced26 100644 --- a/ext/test/quantum.zep.c +++ b/ext/test/quantum.zep.c @@ -340,13 +340,13 @@ PHP_METHOD(Test_Quantum, harmos) { ZVAL_STRING(&_52$$9, "%16.8lf %16.8lf %16.8lf \n"); ZVAL_DOUBLE(&_53$$9, ((double) i * dx)); ZVAL_DOUBLE(&_54$$9, ((double) n * dt)); - ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 75, &fp, &_52$$9, &_53$$9, &_54$$9, &_51$$9); + ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 67, &fp, &_52$$9, &_53$$9, &_54$$9, &_51$$9); zephir_check_call_status(); i = (i + 10); } ZEPHIR_INIT_NVAR(&_56$$8); ZVAL_STRING(&_56$$8, "\n"); - ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 75, &fp, &_56$$8); + ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 67, &fp, &_56$$8); zephir_check_call_status(); } j = 1; diff --git a/ext/test/range.zep.c b/ext/test/range.zep.c index 41627af095..b98db53ff8 100644 --- a/ext/test/range.zep.c +++ b/ext/test/range.zep.c @@ -46,7 +46,7 @@ PHP_METHOD(Test_Range, inclusive1) { ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 10); - ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 76, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 68, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(&_3, &_2); RETURN_CTOR(&_3); @@ -70,7 +70,7 @@ PHP_METHOD(Test_Range, exclusive1) { ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 10); - ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 76, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 68, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(&_3, &_2); RETURN_CTOR(&_3); diff --git a/ext/test/regexdna.zep.c b/ext/test/regexdna.zep.c index 50d1ca49ef..1cfedbab57 100644 --- a/ext/test/regexdna.zep.c +++ b/ext/test/regexdna.zep.c @@ -179,7 +179,7 @@ PHP_METHOD(Test_RegexDNA, process) { ZEPHIR_CONCAT_SVS(&_1, "/", &stuffToRemove, "/mS"); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, ""); - ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 71, &_1, &_0, &contents); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 63, &_1, &_0, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); ZEPHIR_INIT_VAR(&codeLength); @@ -223,7 +223,7 @@ PHP_METHOD(Test_RegexDNA, process) { } } ZEPHIR_INIT_NVAR(®ex); - ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 71, &vIUB, &vIUBnew, &contents); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 63, &vIUB, &vIUBnew, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); php_printf("%c", '\n'); diff --git a/ext/test/requires.zep.c b/ext/test/requires.zep.c index d491228a9a..9868083497 100644 --- a/ext/test/requires.zep.c +++ b/ext/test/requires.zep.c @@ -96,7 +96,7 @@ PHP_METHOD(Test_Requires, requireExternal3) { ZEPHIR_CALL_METHOD(NULL, &external3, "__construct", NULL, 0); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &external3, "req", NULL, 77, path, this_ptr); + ZEPHIR_CALL_METHOD(NULL, &external3, "req", NULL, 69, path, this_ptr); zephir_check_call_status(); RETURN_MM_MEMBER(getThis(), "content"); diff --git a/ext/test/requires/external3.zep.c b/ext/test/requires/external3.zep.c index 13d93c334c..af1e6dd62b 100644 --- a/ext/test/requires/external3.zep.c +++ b/ext/test/requires/external3.zep.c @@ -47,12 +47,12 @@ PHP_METHOD(Test_Requires_External3, req) { - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 78); + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 70); zephir_check_call_status(); if (zephir_require_zval(path TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } - ZEPHIR_CALL_FUNCTION(&_0, "ob_get_contents", NULL, 79); + ZEPHIR_CALL_FUNCTION(&_0, "ob_get_contents", NULL, 71); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, requires, "setcontent", NULL, 0, &_0); zephir_check_call_status(); diff --git a/ext/test/resourcetest.zep.c b/ext/test/resourcetest.zep.c index 90bc869861..3d345b083f 100644 --- a/ext/test/resourcetest.zep.c +++ b/ext/test/resourcetest.zep.c @@ -123,7 +123,7 @@ PHP_METHOD(Test_ResourceTest, testFunctionsForSTDIN) { ZEPHIR_INIT_VAR(&a); ZEPHIR_MM_GET_CONSTANT(&a, "STDIN"); ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_blocking", NULL, 80, &a, &_0); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_blocking", NULL, 72, &a, &_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); diff --git a/ext/test/router.zep.c b/ext/test/router.zep.c index 37029466a6..d17d7582c9 100644 --- a/ext/test/router.zep.c +++ b/ext/test/router.zep.c @@ -139,7 +139,7 @@ PHP_METHOD(Test_Router, __construct) { add_assoc_long_ex(&_1$$3, SL("controller"), 1); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "#^/([a-zA-Z0-9\\_\\-]+)[/]{0,1}$#"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", &_3, 81, &_2$$3, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", &_3, 73, &_2$$3, &_1$$3); zephir_check_call_status(); zephir_array_append(&routes, &_0$$3, PH_SEPARATE, "test/router.zep", 89); ZEPHIR_INIT_NVAR(&_2$$3); @@ -151,7 +151,7 @@ PHP_METHOD(Test_Router, __construct) { add_assoc_long_ex(&_4$$3, SL("params"), 3); ZEPHIR_INIT_VAR(&_5$$3); ZVAL_STRING(&_5$$3, "#^/([a-zA-Z0-9\\_\\-]+)/([a-zA-Z0-9\\.\\_]+)(/.*)*$#"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 81, &_5$$3, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 73, &_5$$3, &_4$$3); zephir_check_call_status(); zephir_array_append(&routes, &_2$$3, PH_SEPARATE, "test/router.zep", 95); } @@ -1036,7 +1036,7 @@ PHP_METHOD(Test_Router, add) { ZEPHIR_INIT_VAR(&route); object_init_ex(&route, test_router_route_ce); - ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 81, pattern, paths, httpMethods); + ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 73, pattern, paths, httpMethods); zephir_check_call_status(); zephir_update_property_array_append(this_ptr, SL("_routes"), &route); RETURN_CCTOR(&route); diff --git a/ext/test/scall.zep.c b/ext/test/scall.zep.c index 24e7e92aa7..031970d7d7 100644 --- a/ext/test/scall.zep.c +++ b/ext/test/scall.zep.c @@ -157,7 +157,7 @@ PHP_METHOD(Test_Scall, testCall3) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 82); + ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 74); zephir_check_call_status(); RETURN_MM(); @@ -221,7 +221,7 @@ PHP_METHOD(Test_Scall, testCall6) { - ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 83, a, b); + ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 75, a, b); zephir_check_call_status(); RETURN_MM(); @@ -267,7 +267,7 @@ PHP_METHOD(Test_Scall, testCall9) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 82); + ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 74); zephir_check_call_status(); RETURN_MM(); @@ -331,7 +331,7 @@ PHP_METHOD(Test_Scall, testCall12) { - ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 83, a, b); + ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 75, a, b); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/scope.zep.c b/ext/test/scope.zep.c index fb7b3914e9..8eea743461 100644 --- a/ext/test/scope.zep.c +++ b/ext/test/scope.zep.c @@ -73,7 +73,7 @@ PHP_METHOD(Test_Scope, test1) { ZEPHIR_INIT_VAR(&ret); ZVAL_STRING(&ret, ""); - ZEPHIR_CALL_SELF(&k, "getstr", &_0, 84); + ZEPHIR_CALL_SELF(&k, "getstr", &_0, 76); zephir_check_call_status(); r = 1; if (r == 1) { @@ -169,7 +169,7 @@ PHP_METHOD(Test_Scope, test3) { } ZEPHIR_INIT_NVAR(&c); ZVAL_LONG(&c, _1); - ZEPHIR_CALL_SELF(&str$$3, "getdystr", &_3, 85, &c); + ZEPHIR_CALL_SELF(&str$$3, "getdystr", &_3, 77, &c); zephir_check_call_status(); zephir_concat_self(&k, &str$$3 TSRMLS_CC); } diff --git a/ext/test/sort.zep.c b/ext/test/sort.zep.c index ce72fb93c8..15b73c58ab 100644 --- a/ext/test/sort.zep.c +++ b/ext/test/sort.zep.c @@ -94,16 +94,16 @@ PHP_METHOD(Test_Sort, quick) { } } } - ZEPHIR_CALL_METHOD(&_7, this_ptr, "quick", &_8, 86, &left); + ZEPHIR_CALL_METHOD(&_7, this_ptr, "quick", &_8, 78, &left); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9); zephir_create_array(&_9, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_10); ZVAL_LONG(&_10, pivot); zephir_array_fast_append(&_9, &_10); - ZEPHIR_CALL_METHOD(&_11, this_ptr, "quick", &_8, 86, &right); + ZEPHIR_CALL_METHOD(&_11, this_ptr, "quick", &_8, 78, &right); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 87, &_7, &_9, &_11); + ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 79, &_7, &_9, &_11); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/spectralnorm.zep.c b/ext/test/spectralnorm.zep.c index b6f93e2b7e..eae4e1a5f6 100644 --- a/ext/test/spectralnorm.zep.c +++ b/ext/test/spectralnorm.zep.c @@ -113,7 +113,7 @@ PHP_METHOD(Test_SpectralNorm, Au) { j = _4$$3; ZVAL_LONG(&_7$$4, i); ZVAL_LONG(&_8$$4, j); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 88, &_7$$4, &_8$$4); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 80, &_7$$4, &_8$$4); zephir_check_call_status(); ZVAL_LONG(&_7$$4, j); ZEPHIR_CALL_METHOD(&_10$$4, u, "offsetget", &_11, 0, &_7$$4); @@ -189,7 +189,7 @@ PHP_METHOD(Test_SpectralNorm, Atu) { j = _4$$3; ZVAL_LONG(&_7$$4, j); ZVAL_LONG(&_8$$4, i); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 88, &_7$$4, &_8$$4); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 80, &_7$$4, &_8$$4); zephir_check_call_status(); ZVAL_LONG(&_7$$4, j); ZEPHIR_CALL_METHOD(&_10$$4, u, "offsetget", &_11, 0, &_7$$4); @@ -226,9 +226,9 @@ PHP_METHOD(Test_SpectralNorm, AtAu) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "au", NULL, 89, n, u, w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "au", NULL, 81, n, u, w); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atu", NULL, 90, n, w, v); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atu", NULL, 82, n, w, v); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -267,17 +267,17 @@ PHP_METHOD(Test_SpectralNorm, process) { ZEPHIR_INIT_VAR(&u); object_init_ex(&u, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &u, "__construct", NULL, 91, &_0); + ZEPHIR_CALL_METHOD(NULL, &u, "__construct", NULL, 83, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&v); object_init_ex(&v, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &v, "__construct", NULL, 91, &_0); + ZEPHIR_CALL_METHOD(NULL, &v, "__construct", NULL, 83, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&w); object_init_ex(&w, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &w, "__construct", NULL, 91, &_0); + ZEPHIR_CALL_METHOD(NULL, &w, "__construct", NULL, 83, &_0); zephir_check_call_status(); _3 = (n - 1); _2 = 0; @@ -295,15 +295,15 @@ PHP_METHOD(Test_SpectralNorm, process) { i = _2; ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &u, "offsetset", &_6, 92, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &u, "offsetset", &_6, 84, &_4$$3, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &v, "offsetset", &_6, 92, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &v, "offsetset", &_6, 84, &_4$$3, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &w, "offsetset", &_6, 92, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &w, "offsetset", &_6, 84, &_4$$3, &_5$$3); zephir_check_call_status(); } } @@ -322,10 +322,10 @@ PHP_METHOD(Test_SpectralNorm, process) { } i = _8; ZVAL_LONG(&_10$$4, n); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 93, &_10$$4, &u, &v, &w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 85, &_10$$4, &u, &v, &w); zephir_check_call_status(); ZVAL_LONG(&_10$$4, n); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 93, &_10$$4, &v, &u, &w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 85, &_10$$4, &v, &u, &w); zephir_check_call_status(); } } @@ -344,19 +344,19 @@ PHP_METHOD(Test_SpectralNorm, process) { } i = _13; ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_15$$5, &u, "offsetget", &_17, 94, &_16$$5); + ZEPHIR_CALL_METHOD(&_15$$5, &u, "offsetget", &_17, 86, &_16$$5); zephir_check_call_status(); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 94, &_16$$5); + ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 86, &_16$$5); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_19$$5); mul_function(&_19$$5, &_15$$5, &_18$$5 TSRMLS_CC); vBv += zephir_get_numberval(&_19$$5); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_15$$5, &v, "offsetget", &_17, 94, &_16$$5); + ZEPHIR_CALL_METHOD(&_15$$5, &v, "offsetget", &_17, 86, &_16$$5); zephir_check_call_status(); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 94, &_16$$5); + ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 86, &_16$$5); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_20$$5); mul_function(&_20$$5, &_15$$5, &_18$$5 TSRMLS_CC); diff --git a/ext/test/strings.zep.c b/ext/test/strings.zep.c index fadec1075f..3b6240d60b 100644 --- a/ext/test/strings.zep.c +++ b/ext/test/strings.zep.c @@ -545,7 +545,7 @@ PHP_METHOD(Test_Strings, strToHex) { _1$$3 = ZEPHIR_STRING_OFFSET(&value, i); ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRINGL(&_2$$3, &_1$$3, 1); - ZEPHIR_CALL_FUNCTION(&_3$$3, "ord", &_4, 95, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "ord", &_4, 87, &_2$$3); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5$$3, "dechex", &_6, 10, &_3$$3); zephir_check_call_status(); @@ -598,17 +598,17 @@ PHP_METHOD(Test_Strings, issue1267) { zephir_fast_str_replace(&_0, &_1, &_2, value TSRMLS_CC); ZEPHIR_CPY_WRT(value, &_0); ZVAL_LONG(&_3, 513); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 96, value, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 88, value, &_3); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_4); ZEPHIR_INIT_NVAR(&_0); - ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 97, value); + ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 89, value); zephir_check_call_status(); zephir_stripslashes(&_0, &_4); ZEPHIR_INIT_VAR(&x); zephir_fast_trim(&x, &_0, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); ZEPHIR_INIT_VAR(&_6); - ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 97, value); + ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 89, value); zephir_check_call_status(); zephir_stripcslashes(&_6, &_7); zephir_fast_trim(return_value, &_6, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); diff --git a/ext/test/trytest.zep.c b/ext/test/trytest.zep.c index d438bb6c13..187f15f68c 100644 --- a/ext/test/trytest.zep.c +++ b/ext/test/trytest.zep.c @@ -192,7 +192,7 @@ PHP_METHOD(Test_TryTest, testTry4) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 98, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 90, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 48 TSRMLS_CC); goto try_end_1; @@ -262,7 +262,7 @@ PHP_METHOD(Test_TryTest, testTry5) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 98, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 90, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 65 TSRMLS_CC); goto try_end_1; @@ -331,7 +331,7 @@ PHP_METHOD(Test_TryTest, testTry6) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 98, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 90, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 82 TSRMLS_CC); goto try_end_1; @@ -399,7 +399,7 @@ PHP_METHOD(Test_TryTest, testTry7) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 98, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 90, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 101 TSRMLS_CC); goto try_end_1; @@ -495,7 +495,7 @@ PHP_METHOD(Test_TryTest, testTry9) { /* try_start_1: */ - ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod1", NULL, 99); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod1", NULL, 91); zephir_check_call_status_or_jump(try_end_1); RETURN_MM_STRING("not catched"); @@ -530,7 +530,7 @@ PHP_METHOD(Test_TryTest, testTry10) { /* try_start_1: */ - ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod2", NULL, 100); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod2", NULL, 92); zephir_check_call_status_or_jump(try_end_1); RETURN_MM_STRING("not catched"); From 3f799b4630730ed501507921c4f699c10bf8c092 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 01:14:19 +0300 Subject: [PATCH 15/38] Correct code style for batch file --- zephir.bat | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/zephir.bat b/zephir.bat index cf3728455e..354888efed 100644 --- a/zephir.bat +++ b/zephir.bat @@ -1,10 +1,10 @@ @echo off -REM This file is part of the Zephir. -REM -REM (c) Zephir Team -REM -REM For the full copyright and license information, please view the LICENSE -REM file that was distributed with this source code. +rem This file is part of the Zephir. +rem +rem (c) Zephir Team +rem +rem For the full copyright and license information, please view the LICENSE +rem file that was distributed with this source code. cls if "%PHP_PEAR_PHP_BIN%" neq "" ( From 51cee9113f1b6b1cb31a6c743cb1f66cffee9e0d Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 02:47:50 +0300 Subject: [PATCH 16/38] Move composer env var to safe place [skip appveyor] --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 32c5ab3150..eeb12a8962 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,7 +41,6 @@ env: - BOX_VERSION=3.3.1 - BUILD_PHAR=0 - PATH="${HOME}/bin:${PATH}" - - DEFAULT_COMPOSER_FLAGS=(--no-interaction --no-ansi --no-progress --no-suggest) - TRAVIS_COMMIT_LOG="$(git log --format=fuller -5)" before_install: @@ -61,6 +60,7 @@ before_install: export PHP_VERNUM="$(php-config --vernum)" [ -d ~/bin ] || mkdir ~/bin + export DEFAULT_COMPOSER_FLAGS=("--no-interaction" "--no-ansi" "--no-progress" "--no-suggest") # Hide "You are in 'detached HEAD' state" message git config --global advice.detachedHead false From 96ee6ca1a7b9f617ab839f7f514d33b6d609c0d8 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 02:48:09 +0300 Subject: [PATCH 17/38] Correct .editorconfig [skip appveyor] --- .editorconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.editorconfig b/.editorconfig index bf900bfd5d..3ca35c6d40 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,14 +15,14 @@ trim_trailing_whitespace = true indent_style = tab tab_width = 4 -[*.{mk,c,h,awk,frag,lemon,re}] +[*.{mk,c,h,awk,bat,frag,lemon,re}] indent_style = tab tab_width = 4 [*.md] trim_trailing_whitespace = false -[*.{yml,sh}] +[*.{yml,m4,json,xml,sh}] indent_size = 2 [zephir-autocomplete] From bc6fd66ee47ad28b2647625c2b07375536d3debd Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 16:34:59 +0300 Subject: [PATCH 18/38] Add apache prototypes --- prototypes/apache.php | 180 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 180 insertions(+) create mode 100644 prototypes/apache.php diff --git a/prototypes/apache.php b/prototypes/apache.php new file mode 100644 index 0000000000..970cbb4908 --- /dev/null +++ b/prototypes/apache.php @@ -0,0 +1,180 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +if (!function_exists('apache_child_terminate')) { + /** + * Terminate apache process after this request. + * + * @see https://www.php.net/manual/en/function.apache-child-terminate.php + * + * @return bool + */ + function apache_child_terminate() + { + } +} + +if (!function_exists('apache_get_modules')) { + /** + * Get a list of loaded Apache modules. + * + * @see https://www.php.net/manual/en/function.apache-get-modules.php + * + * @return array + */ + function apache_get_modules() + { + } +} + +if (!function_exists('apache_get_version')) { + /** + * Fetch Apache version. + * + * @see https://www.php.net/manual/en/function.apache-get-version.php + * + * @return string + */ + function apache_get_version() + { + } +} + +if (!function_exists('apache_getenv')) { + /** + * Get an Apache subprocess_env variable. + * + * @see https://www.php.net/manual/en/function.apache-getenv.php + * + * @param string $variable + * @param bool $walk_to_top + * + * @return string + */ + function apache_getenv($variable, $walk_to_top = false) + { + } +} + +if (!function_exists('apache_lookup_uri')) { + /** + * Perform a partial request for the specified URI and return all info about it. + * + * @see https://www.php.net/manual/en/function.apache-lookup-uri.php + * + * @param string $filename + * + * @return object + */ + function apache_lookup_uri($filename) + { + } +} + +if (!function_exists('apache_note')) { + /** + * Get and set apache request notes. + * + * @see https://www.php.net/manual/en/function.apache-note.php + * + * @param string $note_name + * @param string $note_value + * + * @return object + */ + function apache_note($note_name, $note_value = '') + { + } +} + +if (!function_exists('apache_request_headers')) { + /** + * Fetch all HTTP request headers. + * + * @see https://www.php.net/manual/en/function.apache-request-headers.php + * + * @return array|bool + */ + function apache_request_headers() + { + } +} + +if (!function_exists('apache_reset_timeout')) { + /** + * Reset the Apache write timer. + * + * @see https://www.php.net/manual/en/function.apache-reset-timeout.php + * + * @return bool + */ + function apache_reset_timeout() + { + } +} + +if (!function_exists('apache_response_headers')) { + /** + * Fetch all HTTP response headers. + * + * @see https://www.php.net/manual/en/function.apache-response-headers.php + * + * @return array|bool + */ + function apache_response_headers() + { + } +} + +if (!function_exists('apache_setenv')) { + /** + * Set an Apache subprocess_env variable. + * + * @see https://www.php.net/manual/en/function.apache-setenv.php + * + * @param string $variable + * @param string $value + * @param bool $walk_to_top + * + * @return bool + */ + function apache_setenv($variable, $value, $walk_to_top = false) + { + } +} + +if (!function_exists('getallheaders')) { + /** + * Fetch all HTTP request headers. + * + * @see https://www.php.net/manual/en/function.getallheaders.php + * + * @return array|bool + */ + function getallheaders() + { + } +} + +if (!function_exists('virtual')) { + /** + * Perform an Apache sub-request. + * + * @see https://www.php.net/manual/en/function.virtual.php + * + * @param string $filename + * + * @return bool + */ + function virtual($filename) + { + } +} From 9f672b04014f8b42607903d5aaf44974aaf6dfbc Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 16:35:29 +0300 Subject: [PATCH 19/38] Fixed gd prototypes --- prototypes/gd.php | 1006 +++++++++++++++++++++++++-------------------- 1 file changed, 569 insertions(+), 437 deletions(-) diff --git a/prototypes/gd.php b/prototypes/gd.php index ae13318432..55ba59b8df 100644 --- a/prototypes/gd.php +++ b/prototypes/gd.php @@ -5,500 +5,632 @@ * * (c) Zephir Team * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -if (function_exists('gd_info')) { - return false; + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +if (!function_exists('gd_info')) { + /** + * Retrieve information about the currently installed GD library. + * + * @see http://www.php.net/manual/en/function.gd-info.php + * + * @return array + */ + function gd_info() + { + } } -/** - * Function was prototyped by docs. - * - * @see http://www.php.net/manual/ru/ref.image.php - */ - -/** - * @see http://www.php.net/manual/ru/function.gd-info.php - */ -function gd_info() -{ +if (!function_exists('getimagesize')) { + /** + * Get the size of an image. + * + * @see https://www.php.net/manual/en/function.getimagesize.php + * + * @param string $filename + * @param array $imageinfo + * + * @return array + */ + function getimagesize($filename, array &$imageinfo) + { + } } -/** - * @see http://www.php.net/manual/ru/function.getimagesize.php - * - * @param string $filename - * @param array $imageinfo - * @param mixed $image - * @param mixed $threshold - */ -//function getimagesize($filename, array &$imageinfo) {} - -/** - * @see http://www.php.net/manual/ru/function.getimagesizefromstring.php - * - * @param string $imagedata - * @param array $imageinfo - */ -//function getimagesizefromstring($imagedata, array &$imageinfo) {} +if (!function_exists('getimagesizefromstring')) { + /** + * Get the size of an image from a string. + * + * @see https://www.php.net/manual/en/function.getimagesizefromstring.php + * + * @param string $imagedata + * @param array $imageinfo + * + * @return array + */ + function getimagesizefromstring($imagedata, array &$imageinfo) + { + } +} -/** - * @see http://www.php.net/manual/ru/function.image-type-to-extension.php - * - * @param $imagetype - * @param bool $include_dot - */ -//function image_type_to_extension($imagetype, $include_dot = true) {} +if (!function_exists('image_type_to_extension')) { + /** + * Get file extension for image type. + * + * @see https://www.php.net/manual/en/function.image-type-to-extension.php + * + * @param $imagetype + * @param bool $include_dot + * + * @return string + */ + function image_type_to_extension($imagetype, $include_dot = true) + { + } +} -/** - * @see http://www.php.net/manual/ru/function.image-type-to-mime-type.php - * - * @param int $imagetype - * - * @return string - */ -//function image_type_to_mime_type($imagetype) {} +if (!function_exists('image_type_to_mime_type')) { + /** + * Get Mime-Type for image-type returned by getimagesize, exif_read_data, exif_thumbnail, exif_imagetype. + * + * @see https://www.php.net/manual/en/function.image-type-to-mime-type.php + * + * @param int $imagetype + * + * @return string + */ + function image_type_to_mime_type($imagetype) + { + } +} -/** - * @see http://www.php.net/manual/ru/function.image2wbmp.php - * - * @param resource $image - * @param string $filename - * @param int $threshold - * - * @return bool - */ -function image2wbmp($image, $filename, $threshold) -{ +if (!function_exists('image2wbmp') && PHP_VERSION_ID < 70400) { + /** + * Output image to browser or file. + * + * @see https://www.php.net/manual/en/function.image2wbmp.php + * + * @param resource $image + * @param string $filename + * @param int $threshold + * + * @return bool + */ + function image2wbmp($image, $filename, $threshold) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imageaffine.php - * - * @param $image - * @param array $affline - * @param array $clip - */ -function imageaffine($image, array $affline, array $clip) -{ +if (!function_exists('imageaffine')) { + /** + * Return an image containing the affine transformed src image, using an optional clipping area. + * + * @see https://www.php.net/manual/en/function.imageaffine.php + * + * @param resource $image + * @param array $affline + * @param array $clip + * + * @return resource|bool + */ + function imageaffine($image, array $affline, array $clip = []) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imageaffinematrixconcat.php - * - * @param array $m1 - * @param array $m2 - * - * @return array - */ -function imageaffinematrixconcat(array $m1, array $m2) -{ +if (!function_exists('imageaffinematrixconcat')) { + /** + * Concatenate two affine transformation matrices. + * + * @see https://www.php.net/manual/en/function.imageaffinematrixconcat.php + * + * @param array $m1 + * @param array $m2 + * + * @return array|bool + */ + function imageaffinematrixconcat(array $m1, array $m2) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imageaffinematrixget.php - * - * @param int $type - * @param mixed $options - * - * @return array - */ -function imageaffinematrixget($type, $options) -{ +if (!function_exists('imageaffinematrixget')) { + /** + * Get an affine transformation matrix. + * + * @see https://www.php.net/manual/en/function.imageaffinematrixget.php + * + * @param int $type + * @param mixed $options + * + * @return array|bool + */ + function imageaffinematrixget($type, $options) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagealphablending.php - * - * @param resource $image - * @param bool $blendmode - * - * @return bool - */ -function imagealphablending($image, $blendmode) -{ +if (!function_exists('imagealphablending')) { + /** + * Set the blending mode for an image. + * + * @see https://www.php.net/manual/en/function.imagealphablending.php + * + * @param resource $image + * @param bool $blendmode + * + * @return bool + */ + function imagealphablending($image, $blendmode) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imageantialias.php - * - * @param resource $image - * @param bool $enabled - * - * @return bool - */ -function imageantialias($image, $enabled) -{ +if (!function_exists('imageantialias')) { + /** + * Should antialias functions be used or not. + * + * @see https://www.php.net/manual/en/function.imageantialias.php + * + * @param resource $image + * @param bool $enabled + * + * @return bool + */ + function imageantialias($image, $enabled) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagearc.php - * - * @param resource $image - * @param int $cx - * @param int $cy - * @param int $width - * @param int $height - * @param int $start - * @param int $end - * @param int $color - * - * @return bool - */ -function imagearc($image, $cx, $cy, $width, $height, $start, $end, $color) -{ +if (!function_exists('imagearc')) { + /** + * Draws an arc. + * + * @see http://www.php.net/manual/ru/function.imagearc.php + * + * @param resource $image + * @param int $cx + * @param int $cy + * @param int $width + * @param int $height + * @param int $start + * @param int $end + * @param int $color + * + * @return bool + */ + function imagearc($image, $cx, $cy, $width, $height, $start, $end, $color) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagechar.php - * - * @param resource $image - * @param int $font - * @param int $x - * @param int $y - * @param string $c - * @param int $color - * - * @return bool - */ -function imagechar($image, $font, $x, $y, $c, $color) -{ +if (!function_exists('imagechar')) { + /** + * Draw a character horizontally. + * + * @see https://www.php.net/manual/en/function.imagechar.php + * + * @param resource $image + * @param int $font + * @param int $x + * @param int $y + * @param string $c + * @param int $color + * + * @return bool + */ + function imagechar($image, $font, $x, $y, $c, $color) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecharup.php - * - * @param resource $image - * @param int $font - * @param int $x - * @param int $y - * @param string $c - * @param int $color - * - * @return bool - */ -function imagecharup($image, $font, $x, $y, $c, $color) -{ +if (!function_exists('imagecharup')) { + /** + * Draw a character vertically. + * + * @see https://www.php.net/manual/en/function.imagecharup.php + * + * @param resource $image + * @param int $font + * @param int $x + * @param int $y + * @param string $c + * @param int $color + * + * @return bool + */ + function imagecharup($image, $font, $x, $y, $c, $color) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorallocate.php - * - * @param resource $image - * @param int $red - * @param int $green - * @param int $blue - * - * @return int - */ -function imagecolorallocate($image, $red, $green, $blue) -{ +if (!function_exists('imagecolorallocate')) { + /** + * Allocate a color for an image. + * + * @see https://www.php.net/manual/en/function.imagecolorallocate.php + * + * @param resource $image + * @param int $red + * @param int $green + * @param int $blue + * + * @return int|bool + */ + function imagecolorallocate($image, $red, $green, $blue) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorallocatealpha.php - * - * @param resource $image - * @param int $red - * @param int $green - * @param int $blue - * @param int $alpha - * - * @return int - */ -function imagecolorallocatealpha($image, $red, $green, $blue, $alpha) -{ +if (!function_exists('imagecolorallocatealpha')) { + /** + * Allocate a color for an image. + * + * @see https://www.php.net/manual/en/function.imagecolorallocatealpha.php + * + * @param resource $image + * @param int $red + * @param int $green + * @param int $blue + * @param int $alpha + * + * @return int|bool + */ + function imagecolorallocatealpha($image, $red, $green, $blue, $alpha) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorat.php - * - * @param resource $image - * @param int $x - * @param int $y - * - * @return int - */ -function imagecolorat($image, $x, $y) -{ +if (!function_exists('imagecolorat')) { + /** + * Get the index of the color of a pixel. + * + * @see https://www.php.net/manual/en/function.imagecolorat.php + * + * @param resource $image + * @param int $x + * @param int $y + * + * @return int|false + */ + function imagecolorat($image, $x, $y) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorclosest.php - * - * @param resource $image - * @param int $red - * @param int $green - * @param int $blue - * - * @return int - */ -function imagecolorclosest($image, $red, $green, $blue) -{ +if (!function_exists('imagecolorclosest')) { + /** + * Get the index of the closest color to the specified color. + * + * @see https://www.php.net/manual/en/function.imagecolorclosest.php + * + * @param resource $image + * @param int $red + * @param int $green + * @param int $blue + * + * @return int + */ + function imagecolorclosest($image, $red, $green, $blue) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorclosestalpha.php - * - * @param resource $image - * @param int $red - * @param int $green - * @param int $blue - * @param int $alpha - * - * @return int - */ -function imagecolorclosestalpha($image, $red, $green, $blue, $alpha) -{ +if (!function_exists('imagecolorclosestalpha')) { + /** + * Get the index of the closest color to the specified color + alpha. + * + * @see https://www.php.net/manual/en/function.imagecolorclosestalpha.php + * + * @param resource $image + * @param int $red + * @param int $green + * @param int $blue + * @param int $alpha + * + * @return int + */ + function imagecolorclosestalpha($image, $red, $green, $blue, $alpha) + { + } } -/** - * @param resource $image - * @param int $red - * @param int $green - * @param int $blue - * - * @return int - */ -function imagecolorclosesthwb($image, $red, $green, $blue) -{ +if (!function_exists('imagecolorclosesthwb')) { + /** + * Get the index of the color which has the hue, white and blackness. + * + * @see https://www.php.net/manual/en/function.imagecolorclosesthwb.php + * + * @param resource $image + * @param int $red + * @param int $green + * @param int $blue + * + * @return int + */ + function imagecolorclosesthwb($image, $red, $green, $blue) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolordeallocate.php - * - * @param resource $image - * @param int $color - * - * @return bool - */ -function imagecolordeallocate($image, $color) -{ +if (!function_exists('imagecolordeallocate')) { + /** + * De-allocate a color for an image. + * + * @see https://www.php.net/manual/en/function.imagecolordeallocate.php + * + * @param resource $image + * @param int $color + * + * @return bool + */ + function imagecolordeallocate($image, $color) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorexact.php - * - * @param resource $image - * @param int $red - * @param int $green - * @param int $blue - * - * @return int - */ -function imagecolorexact($image, $red, $green, $blue) -{ +if (!function_exists('imagecolorexact')) { + /** + * Get the index of the specified color. + * + * @see http://www.php.net/manual/ru/function.imagecolorexact.php + * + * @param resource $image + * @param int $red + * @param int $green + * @param int $blue + * + * @return int + */ + function imagecolorexact($image, $red, $green, $blue) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorexactalpha.php - * - * @param resource $image - * @param int $red - * @param int $green - * @param int $blue - * @param int $alpha - * - * @return int - */ -function imagecolorexactalpha($image, $red, $green, $blue, $alpha) -{ +if (!function_exists('imagecolorexactalpha')) { + /** + * Get the index of the specified color + alpha. + * + * @see https://www.php.net/manual/en/function.imagecolorexactalpha.php + * + * @param resource $image + * @param int $red + * @param int $green + * @param int $blue + * @param int $alpha + * + * @return int + */ + function imagecolorexactalpha($image, $red, $green, $blue, $alpha) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolormatch.php - * - * @param resource $image1 - * @param resource $image2 - * - * @return bool - */ -function imagecolormatch($image1, $image2) -{ +if (!function_exists('imagecolormatch')) { + /** + * Makes the colors of the palette version of an image more closely match the true color version. + * + * @see http://www.php.net/manual/ru/function.imagecolormatch.php + * + * @param resource $image1 + * @param resource $image2 + * + * @return bool + */ + function imagecolormatch($image1, $image2) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorresolve.php - * - * @param resource $image - * @param int $red - * @param int $green - * @param int $blue - * - * @return int - */ -function imagecolorresolve($image, $red, $green, $blue) -{ +if (!function_exists('imagecolorresolve')) { + /** + * Get the index of the specified color or its closest possible alternative. + * + * @see http://www.php.net/manual/ru/function.imagecolorresolve.php + * + * @param resource $image + * @param int $red + * @param int $green + * @param int $blue + * + * @return int + */ + function imagecolorresolve($image, $red, $green, $blue) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorresolvealpha.php - * - * @param resource $image - * @param int $red - * @param int $green - * @param int $blue - * @param int $alpha - * - * @return int - */ -function imagecolorresolvealpha($image, $red, $green, $blue, $alpha) -{ +if (!function_exists('imagecolorresolvealpha')) { + /** + * Get the index of the specified color + alpha or its closest possible alternative. + * + * @see https://www.php.net/manual/en/function.imagecolorresolvealpha.php + * + * @param resource $image + * @param int $red + * @param int $green + * @param int $blue + * @param int $alpha + * + * @return int + */ + function imagecolorresolvealpha($image, $red, $green, $blue, $alpha) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorset.php - * - * @param resource $image - * @param int $index - * @param int $red - * @param int $green - * @param int $blue - * @param int $alpha - */ -function imagecolorset($image, $index, $red, $green, $blue, $alpha = 0) -{ +if (!function_exists('imagecolorset')) { + /** + * Set the color for the specified palette index. + * + * @see https://www.php.net/manual/en/function.imagecolorset.php + * + * @param resource $image + * @param int $index + * @param int $red + * @param int $green + * @param int $blue + * @param int $alpha + */ + function imagecolorset($image, $index, $red, $green, $blue, $alpha = 0) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecolorsforindex.php - * - * @param resource $image - * @param int $index - * - * @return array - */ -function imagecolorsforindex($image, $index) -{ +if (!function_exists('imagecolorsforindex')) { + /** + * Get the colors for an index. + * + * @see https://www.php.net/manual/en/function.imagecolorsforindex.php + * + * @param resource $image + * @param int $index + * + * @return array + */ + function imagecolorsforindex($image, $index) + { + } } -/** - * @see http://www.php.net/manual/ru/function.imagecreate.php - * - * @param $width - * @param $height - * - * @return resource - */ -function imagecreate($width, $height) -{ +if (!function_exists('imagecreate')) { + /** + * Create a new palette based image. + * + * @see https://www.php.net/manual/en/function.imagecreate.php + * + * @param $width + * @param $height + * + * @return resource|bool + */ + function imagecreate($width, $height) + { + } } -/** - * http://php.net/manual/en/function.imagettfbbox.php. - * - * @param float $size - * @param float $angle - * @param string $fontfile - * @param string $text - * - * @return array|bool - */ -function imagettfbbox($size, $angle, $fontfile, $text) -{ +if (!function_exists('imagettfbbox')) { + /** + * Give the bounding box of a text using TrueType fonts. + * + * @see https://www.php.net/manual/en/function.imagettfbbox.php + * + * @param float $size + * @param float $angle + * @param string $fontfile + * @param string $text + * + * @return array|bool + */ + function imagettfbbox($size, $angle, $fontfile, $text) + { + } } -/** - * @see http://php.net/manual/en/function.imagettftext.php - * - * @param resource $image - * @param float $size - * @param float $angle - * @param int $x - * @param int $y - * @param int $color - * @param string $fontfile - * @param string $text - * - * @return array|bool - */ -function imagettftext($image, $size, $angle, $x, $y, $color, $fontfile, $text) -{ +if (!function_exists('imagettftext')) { + /** + * Write text to the image using TrueType fonts. + * + * @see https://www.php.net/manual/en/function.imagettftext.php + * + * @param resource $image + * @param float $size + * @param float $angle + * @param int $x + * @param int $y + * @param int $color + * @param string $fontfile + * @param string $text + * + * @return array|bool + */ + function imagettftext($image, $size, $angle, $x, $y, $color, $fontfile, $text) + { + } } /* - * @link http://php.net/manual/en/image.constants.php - */ -define('IMG_GIF', 1); -define('IMG_JPG', 2); -define('IMG_JPEG', 2); -define('IMG_PNG', 4); -define('IMG_WBMP', 8); -define('IMG_XPM', 16); -define('IMG_COLOR_TILED', -5); -define('IMG_COLOR_STYLED', -2); -define('IMG_COLOR_BRUSHED', -3); -define('IMG_COLOR_STYLEDBRUSHED', -4); -define('IMG_COLOR_TRANSPARENT', -6); -define('IMG_ARC_ROUNDED', 0); -define('IMG_ARC_PIE', 0); -define('IMG_ARC_CHORD', 1); -define('IMG_ARC_NOFILL', 2); -define('IMG_ARC_EDGED', 4); -define('IMG_GD2_RAW', 1); -define('IMG_GD2_COMPRESSED', 2); -define('IMG_EFFECT_REPLACE', 0); -define('IMG_EFFECT_ALPHABLEND', 1); -define('IMG_EFFECT_NORMAL', 2); -define('IMG_EFFECT_OVERLAY', 3); -define('GD_BUNDLED', 1); -define('IMG_FILTER_NEGATE', 0); -define('IMG_FILTER_GRAYSCALE', 1); -define('IMG_FILTER_BRIGHTNESS', 2); -define('IMG_FILTER_CONTRAST', 3); -define('IMG_FILTER_COLORIZE', 4); -define('IMG_FILTER_EDGEDETECT', 5); -define('IMG_FILTER_GAUSSIAN_BLUR', 7); -define('IMG_FILTER_SELECTIVE_BLUR', 8); -define('IMG_FILTER_EMBOSS', 6); -define('IMG_FILTER_MEAN_REMOVAL', 9); -define('IMG_FILTER_SMOOTH', 10); -define('IMG_FILTER_PIXELATE', 11); -define('GD_VERSION', '2.0.35'); -define('GD_MAJOR_VERSION', 2); -define('GD_MINOR_VERSION', 0); -define('GD_RELEASE_VERSION', 35); -define('GD_EXTRA_VERSION', ''); -define('PNG_NO_FILTER', 0); -define('PNG_FILTER_NONE', 8); -define('PNG_FILTER_SUB', 16); -define('PNG_FILTER_UP', 32); -define('PNG_FILTER_AVG', 64); -define('PNG_FILTER_PAETH', 128); -define('PNG_ALL_FILTERS', 248); -define('IMG_AFFINE_TRANSLATE', 0); -define('IMG_AFFINE_SCALE', 1); -define('IMG_AFFINE_ROTATE', 2); -define('IMG_AFFINE_SHEAR_HORIZONTAL', 3); -define('IMG_AFFINE_SHEAR_VERTICAL', 4); -define('IMG_CROP_DEFAULT', 0); -define('IMG_CROP_TRANSPARENT', 1); -define('IMG_CROP_BLACK', 2); -define('IMG_CROP_WHITE', 3); -define('IMG_CROP_SIDES', 4); -define('IMG_FLIP_BOTH', 3); -define('IMG_FLIP_HORIZONTAL', 1); -define('IMG_FLIP_VERTICAL', 2); -define('IMG_BELL', 1); -define('IMG_BESSEL', 2); -define('IMG_BICUBIC', 4); -define('IMG_BICUBIC_FIXED', 5); -define('IMG_BILINEAR_FIXED', 3); -define('IMG_BLACKMAN', 6); -define('IMG_BOX', 7); -define('IMG_BSPLINE', 8); -define('IMG_CATMULLROM', 9); -define('IMG_GAUSSIAN', 10); -define('IMG_GENERALIZED_CUBIC', 11); -define('IMG_HERMITE', 12); -define('IMG_HAMMING', 13); -define('IMG_HANNING', 14); -define('IMG_MITCHELL', 15); -define('IMG_POWER', 17); -define('IMG_QUADRATIC', 18); -define('IMG_SINC', 19); -define('IMG_NEAREST_NEIGHBOUR', 16); -define('IMG_WEIGHTED4', 21); -define('IMG_TRIANGLE', 20); + * @link https://www.php.net/manual/en/image.constants.php + */ +defined('IMG_GIF') || define('IMG_GIF', 1); +defined('IMG_JPG') || define('IMG_JPG', 2); +defined('IMG_JPEG') || define('IMG_JPEG', 2); +defined('IMG_PNG') || define('IMG_PNG', 4); +defined('IMG_WBMP') || define('IMG_WBMP', 8); +defined('IMG_XPM') || define('IMG_XPM', 16); +defined('IMG_COLOR_TILED') || define('IMG_COLOR_TILED', -5); +defined('IMG_COLOR_STYLED') || define('IMG_COLOR_STYLED', -2); +defined('IMG_COLOR_BRUSHED') || define('IMG_COLOR_BRUSHED', -3); +defined('IMG_COLOR_STYLEDBRUSHED') || define('IMG_COLOR_STYLEDBRUSHED', -4); +defined('IMG_COLOR_TRANSPARENT') || define('IMG_COLOR_TRANSPARENT', -6); +defined('IMG_ARC_ROUNDED') || define('IMG_ARC_ROUNDED', 0); +defined('IMG_ARC_PIE') || define('IMG_ARC_PIE', 0); +defined('IMG_ARC_CHORD') || define('IMG_ARC_CHORD', 1); +defined('IMG_ARC_NOFILL') || define('IMG_ARC_NOFILL', 2); +defined('IMG_ARC_EDGED') || define('IMG_ARC_EDGED', 4); +defined('IMG_GD2_RAW') || define('IMG_GD2_RAW', 1); +defined('IMG_GD2_COMPRESSED') || define('IMG_GD2_COMPRESSED', 2); +defined('IMG_EFFECT_REPLACE') || define('IMG_EFFECT_REPLACE', 0); +defined('IMG_EFFECT_ALPHABLEND') || define('IMG_EFFECT_ALPHABLEND', 1); +defined('IMG_EFFECT_NORMAL') || define('IMG_EFFECT_NORMAL', 2); +defined('IMG_EFFECT_OVERLAY') || define('IMG_EFFECT_OVERLAY', 3); +defined('GD_BUNDLED') || define('GD_BUNDLED', 1); +defined('IMG_FILTER_NEGATE') || define('IMG_FILTER_NEGATE', 0); +defined('IMG_FILTER_GRAYSCALE') || define('IMG_FILTER_GRAYSCALE', 1); +defined('IMG_FILTER_BRIGHTNESS') || define('IMG_FILTER_BRIGHTNESS', 2); +defined('IMG_FILTER_CONTRAST') || define('IMG_FILTER_CONTRAST', 3); +defined('IMG_FILTER_COLORIZE') || define('IMG_FILTER_COLORIZE', 4); +defined('IMG_FILTER_EDGEDETECT') || define('IMG_FILTER_EDGEDETECT', 5); +defined('IMG_FILTER_GAUSSIAN_BLUR') || define('IMG_FILTER_GAUSSIAN_BLUR', 7); +defined('IMG_FILTER_SELECTIVE_BLUR') || define('IMG_FILTER_SELECTIVE_BLUR', 8); +defined('IMG_FILTER_EMBOSS') || define('IMG_FILTER_EMBOSS', 6); +defined('IMG_FILTER_MEAN_REMOVAL') || define('IMG_FILTER_MEAN_REMOVAL', 9); +defined('IMG_FILTER_SMOOTH') || define('IMG_FILTER_SMOOTH', 10); +defined('IMG_FILTER_PIXELATE') || define('IMG_FILTER_PIXELATE', 11); +defined('GD_VERSION') || define('GD_VERSION', '2.0.35'); +defined('GD_MAJOR_VERSION') || define('GD_MAJOR_VERSION', 2); +defined('GD_MINOR_VERSION') || define('GD_MINOR_VERSION', 0); +defined('GD_RELEASE_VERSION') || define('GD_RELEASE_VERSION', 35); +defined('GD_EXTRA_VERSION') || define('GD_EXTRA_VERSION', ''); +defined('PNG_NO_FILTER') || define('PNG_NO_FILTER', 0); +defined('PNG_FILTER_NONE') || define('PNG_FILTER_NONE', 8); +defined('PNG_FILTER_SUB') || define('PNG_FILTER_SUB', 16); +defined('PNG_FILTER_UP') || define('PNG_FILTER_UP', 32); +defined('PNG_FILTER_AVG') || define('PNG_FILTER_AVG', 64); +defined('PNG_FILTER_PAETH') || define('PNG_FILTER_PAETH', 128); +defined('PNG_ALL_FILTERS') || define('PNG_ALL_FILTERS', 248); +defined('IMG_AFFINE_TRANSLATE') || define('IMG_AFFINE_TRANSLATE', 0); +defined('IMG_AFFINE_SCALE') || define('IMG_AFFINE_SCALE', 1); +defined('IMG_AFFINE_ROTATE') || define('IMG_AFFINE_ROTATE', 2); +defined('IMG_AFFINE_SHEAR_HORIZONTAL') || define('IMG_AFFINE_SHEAR_HORIZONTAL', 3); +defined('IMG_AFFINE_SHEAR_VERTICAL') || define('IMG_AFFINE_SHEAR_VERTICAL', 4); +defined('IMG_CROP_DEFAULT') || define('IMG_CROP_DEFAULT', 0); +defined('IMG_CROP_TRANSPARENT') || define('IMG_CROP_TRANSPARENT', 1); +defined('IMG_CROP_BLACK') || define('IMG_CROP_BLACK', 2); +defined('IMG_CROP_WHITE') || define('IMG_CROP_WHITE', 3); +defined('IMG_CROP_SIDES') || define('IMG_CROP_SIDES', 4); +defined('IMG_FLIP_BOTH') || define('IMG_FLIP_BOTH', 3); +defined('IMG_FLIP_HORIZONTAL') || define('IMG_FLIP_HORIZONTAL', 1); +defined('IMG_FLIP_VERTICAL') || define('IMG_FLIP_VERTICAL', 2); +defined('IMG_BELL') || define('IMG_BELL', 1); +defined('IMG_BESSEL') || define('IMG_BESSEL', 2); +defined('IMG_BICUBIC') || define('IMG_BICUBIC', 4); +defined('IMG_BICUBIC_FIXED') || define('IMG_BICUBIC_FIXED', 5); +defined('IMG_BILINEAR_FIXED') || define('IMG_BILINEAR_FIXED', 3); +defined('IMG_BLACKMAN') || define('IMG_BLACKMAN', 6); +defined('IMG_BOX') || define('IMG_BOX', 7); +defined('IMG_BSPLINE') || define('IMG_BSPLINE', 8); +defined('IMG_CATMULLROM') || define('IMG_CATMULLROM', 9); +defined('IMG_GAUSSIAN') || define('IMG_GAUSSIAN', 10); +defined('IMG_GENERALIZED_CUBIC') || define('IMG_GENERALIZED_CUBIC', 11); +defined('IMG_HERMITE') || define('IMG_HERMITE', 12); +defined('IMG_HAMMING') || define('IMG_HAMMING', 13); +defined('IMG_HANNING') || define('IMG_HANNING', 14); +defined('IMG_MITCHELL') || define('IMG_MITCHELL', 15); +defined('IMG_POWER') || define('IMG_POWER', 17); +defined('IMG_QUADRATIC') || define('IMG_QUADRATIC', 18); +defined('IMG_SINC') || define('IMG_SINC', 19); +defined('IMG_NEAREST_NEIGHBOUR') || define('IMG_NEAREST_NEIGHBOUR', 16); +defined('IMG_WEIGHTED4') || define('IMG_WEIGHTED4', 21); +defined('IMG_TRIANGLE') || define('IMG_TRIANGLE', 20); From 2dfa34c03df8c69ab2e9df4f7ba5a7705f550b48 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sat, 3 Aug 2019 16:44:04 +0300 Subject: [PATCH 20/38] Fixed mongo prototypes --- prototypes/manage.php | 39 --------------- prototypes/mongo.php | 109 +++++++++++++++++++++++------------------ prototypes/mongodb.php | 71 +++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 88 deletions(-) delete mode 100644 prototypes/manage.php create mode 100644 prototypes/mongodb.php diff --git a/prototypes/manage.php b/prototypes/manage.php deleted file mode 100644 index 76cd54046a..0000000000 --- a/prototypes/manage.php +++ /dev/null @@ -1,39 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace MongoDB\Driver; - -class manage -{ - public function __construct($uri, $options, $driverOptions) - { - } - - public function executeQuery($namespace, $query, $readPreference) - { - } - - public function executeBulkWrite($namespace, $bulk, $writeConcern) - { - } - - public function executeCommand($db, $command, $readPreference) - { - } - - public function getServers() - { - } - - public function selectServer($readPreference) - { - } -} diff --git a/prototypes/mongo.php b/prototypes/mongo.php index 51fe2cf372..af15830f58 100644 --- a/prototypes/mongo.php +++ b/prototypes/mongo.php @@ -5,63 +5,74 @@ * * (c) Zephir Team * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. */ -class MongoClient -{ - const VERSION = ''; - const DEFAULT_HOST = 'localhost'; - const DEFAULT_PORT = 27017; - const RP_PRIMARY = 'primary'; - const RP_PRIMARY_PREFERRED = 'primaryPreferred'; - const RP_SECONDARY = 'secondary'; - const RP_SECONDARY_PREFERRED = 'secondaryPreferred'; - const RP_NEAREST = 'nearest'; +namespace { + if (!class_exists('MongoRegex', false)) { + class MongoRegex + { + } + } - /** - * @see http://www.php.net/manual/en/mongoclient.selectdb.php - * - * @param string $name - * - * @return MongoDB - */ - public function selectDB($name) - { - return new MongoDB($this, $name); + if (!class_exists('MongoDate', false)) { + class MongoDate + { + } } -} -class MongoDate -{ -} + if (!class_exists('MongoId', false)) { + class MongoId + { + } + } -class MongoDB -{ - const PROFILING_OFF = 0; - const PROFILING_SLOW = 1; - const PROFILING_ON = 2; + if (!class_exists('MongoDB', false)) { + class MongoDB + { + const PROFILING_OFF = 0; + const PROFILING_SLOW = 1; + const PROFILING_ON = 2; - /** - * @see http://www.php.net/manual/en/mongodb.construct.php - * - * @param MongoClient $conn - * @param string $name - */ - public function __construct(MongoClient $conn, $name) - { + /** + * Creates a new database. + * + * @see https://www.php.net/manual/en/mongodb.construct.php + * + * @param MongoClient $conn + * @param string $name + */ + public function __construct(MongoClient $conn, $name) + { + } + } } -} -class Mongo extends MongoClient -{ -} - -class MongoId -{ -} + if (!class_exists('MongoClient', false)) { + class MongoClient + { + const VERSION = ''; + const DEFAULT_HOST = 'localhost'; + const DEFAULT_PORT = 27017; + const RP_PRIMARY = 'primary'; + const RP_PRIMARY_PREFERRED = 'primaryPreferred'; + const RP_SECONDARY = 'secondary'; + const RP_SECONDARY_PREFERRED = 'secondaryPreferred'; + const RP_NEAREST = 'nearest'; -class MongoRegex -{ + /** + * Gets a database. + * + * @see https://www.php.net/manual/en/mongoclient.selectdb.php + * + * @param string $name + * + * @return MongoDB + */ + public function selectDB($name) + { + } + } + } } diff --git a/prototypes/mongodb.php b/prototypes/mongodb.php new file mode 100644 index 0000000000..dea3a25171 --- /dev/null +++ b/prototypes/mongodb.php @@ -0,0 +1,71 @@ + + * + * For the full copyright and license information, please view + * the LICENSE file that was distributed with this source code. + */ + +namespace MongoDB\Driver { + if (!class_exists('MongoDB\Driver\Manager', false)) { + class mongodb + { + public function __construct($uri = 'mongodb://127.0.0.1/', array $options = [], array $driverOptions = []) + { + } + + public function executeQuery($namespace, $query, $readPreference) + { + } + + public function executeBulkWrite($namespace, $bulk, $writeConcern) + { + } + + public function executeCommand($db, $command, $readPreference) + { + } + + public function getServers() + { + } + + public function selectServer($readPreference) + { + } + + public function executeReadCommand($db, $command, array $options = []) + { + } + + public function executeReadWriteCommand($db, $command, array $options = []) + { + } + + public function executeWriteCommand($db, $command, array $options = []) + { + } + + public function getReadConcern() + { + } + + public function getReadPreference() + { + } + + public function getWriteConcern() + { + } + + public function startSession(array $options = []) + { + } + } + } +} From faf402d2398f0648d6804a0d8ccf77dbd817bef0 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 17:09:25 +0300 Subject: [PATCH 21/38] Improved sharness test [skip appveyor] --- unit-tests/sharness/Makefile | 2 +- unit-tests/sharness/setup.sh | 44 +++++++++++++++------- unit-tests/sharness/t0001-compile.sh | 33 +++++++++-------- unit-tests/sharness/t0002-generate.sh | 47 ++++++++++++------------ unit-tests/sharness/t0003-init-errors.sh | 23 ++++++------ 5 files changed, 83 insertions(+), 66 deletions(-) diff --git a/unit-tests/sharness/Makefile b/unit-tests/sharness/Makefile index 99886f0b9e..1ca5f0b844 100644 --- a/unit-tests/sharness/Makefile +++ b/unit-tests/sharness/Makefile @@ -41,7 +41,7 @@ $(T): clean-test-results deps .PHONY: aggregate aggregate: clean-test-results $(T) @echo "*** $@ ***" - ls test-results/t*-*.sh.*.counts | $(AGGREGATE) + find ./test-results -name 't*-*.sh.*.counts' | $(AGGREGATE) .PHONY: deps deps: $(SHARNESS) $(BINS) diff --git a/unit-tests/sharness/setup.sh b/unit-tests/sharness/setup.sh index 9d79a8f1b2..1c88a4298f 100644 --- a/unit-tests/sharness/setup.sh +++ b/unit-tests/sharness/setup.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + # This file is part of the Zephir. # # (c) Zephir Team @@ -8,29 +10,43 @@ # set sharness verbosity. we set the env var directly as # it's too late to pass in --verbose, and --verbose is harder # to pass through in some cases. +# shellcheck disable=SC2034 test "$TEST_VERBOSE" = 1 && verbose=t -SHARNESS_LIB="./lib/sharness/sharness.sh" +readonly SHARNESS_LIB="./lib/sharness/sharness.sh" -. "$SHARNESS_LIB" || { - echo >&2 "Cannot source: $SHARNESS_LIB" - echo >&2 "Please check Sharness installation." - exit 1 +# shellcheck source=lib/sharness/sharness.sh +source "$SHARNESS_LIB" || { + echo >&2 "Cannot source: $SHARNESS_LIB" + echo >&2 "Please check Sharness installation." + exit 1 } if test "$TEST_VERBOSE" = 1; then - echo '# TEST_VERBOSE='"$TEST_VERBOSE" + echo '# TEST_VERBOSE='"$TEST_VERBOSE" fi +# shellcheck disable=SC2155 export ZEPHIRDIR=$(cd "$(dirname $0)/../../../"; pwd) + +# shellcheck disable=SC2155 export TESTSDIR=$(cd "$(dirname $0)/../../"; pwd) export FIXTURESDIR="$TESTSDIR/fixtures" export OUTPUTDIR="$TESTSDIR/output" - -export ZEPHIR_BIN="${ZEPHIRDIR}/zephir" - -: ${PHP:=php} - -export PHP_VERSION_ID=$(${PHP} -r 'echo PHP_VERSION_ID;') - -alias zephir="${PHP} ${ZEPHIR_BIN}" +export ZEPHIR_BIN="$ZEPHIRDIR/zephir" +# shellcheck disable=SC2155 +export PHP_VERSION_ID=$(php -r 'echo PHP_VERSION_ID;') + +# shellcheck disable=SC2139 +alias zephir="php $ZEPHIR_BIN" + +function cleanup_output() { + [ -n "$1" ] || return 0 + + for f in $1; do + test -f "$OUTPUTDIR/$f" && { + test "$TEST_VERBOSE" = 1 && (>&1 printf "rm -f %s\n" "$OUTPUTDIR/$f") + rm -f "$OUTPUTDIR/$f" + } + done +} diff --git a/unit-tests/sharness/t0001-compile.sh b/unit-tests/sharness/t0001-compile.sh index fc0cf8ba12..8572ad442d 100755 --- a/unit-tests/sharness/t0001-compile.sh +++ b/unit-tests/sharness/t0001-compile.sh @@ -1,23 +1,24 @@ -#!/bin/sh +#!/usr/bin/env bash +# shellcheck disable=SC2034 test_description="Test compile commands" -. ./setup.sh +source ./setup.sh -cflags="'-O2 -fvisibility=hidden -Wparentheses\( -flto\)\? -DZEPHIR_RELEASE=1'" -test_expect_success "Compile the extension in production mode" ' - cd $FIXTURESDIR/devmode && - zephir fullclean 2>&1 >/dev/null && - zephir compile --no-dev 2>&1 >/dev/null && - cat ext/config.nice | grep -e "^CFLAGS=$cflags" -' +regexp="'-O2 -fvisibility=hidden -Wparentheses\( -flto\)\? -DZEPHIR_RELEASE=1'" +test_expect_success "Compile the extension in production mode" " +cd $FIXTURESDIR/devmode && + zephir fullclean 2>&1 >/dev/null && + zephir compile --no-dev 2>&1 >/dev/null && + grep -q -e \"^CFLAGS=$regexp\" ext/config.nice +" -cflags="'-O0 -g3'" -test_expect_success "Compile the extension in development mode" ' - cd $FIXTURESDIR/devmode && - zephir fullclean 2>&1 >/dev/null && - zephir compile --dev 2>&1 >/dev/null && - cat ext/config.nice | grep -e "^CFLAGS=$cflags" -' +regexp="'-O0 -g3'" +test_expect_success "Compile the extension in development mode" " + cd $FIXTURESDIR/devmode && + zephir fullclean 2>&1 >/dev/null && + zephir compile --dev 2>&1 >/dev/null && + grep -q -e \"^CFLAGS=$regexp\" ext/config.nice +" test_done diff --git a/unit-tests/sharness/t0002-generate.sh b/unit-tests/sharness/t0002-generate.sh index 6ca0721f6e..303aaf77bd 100755 --- a/unit-tests/sharness/t0002-generate.sh +++ b/unit-tests/sharness/t0002-generate.sh @@ -1,32 +1,33 @@ -#!/bin/sh +#!/usr/bin/env bash +# shellcheck disable=SC2034 test_description="Test generate commands" -. ./setup.sh +source ./setup.sh -test_expect_success "Should correctly specify ARGINFO" ' - cd $FIXTURESDIR/typehints && - zephir fullclean 2>&1 >/dev/null && - zephir generate --backend=ZendEngine3 2>&1 >/dev/null && - test_cmp ext/typehints.c expected3.c && - test_cmp ext/typehints/args.zep.h expected_args3.h && - test_cmp ext/typehints/retval.zep.h expected_retval3.h && - test_cmp ext/typehints/both.zep.h expected_both3.h -' +test_expect_success "Should correctly specify ARGINFO" " + cd $FIXTURESDIR/typehints && + zephir fullclean 2>&1 >/dev/null && + zephir generate --backend=ZendEngine3 2>&1 >/dev/null && + test_cmp ext/typehints.c expected3.c && + test_cmp ext/typehints/args.zep.h expected_args3.h && + test_cmp ext/typehints/retval.zep.h expected_retval3.h && + test_cmp ext/typehints/both.zep.h expected_both3.h +" -test_expect_success "Life Cycle Test" ' - cd $FIXTURESDIR/lifecycle && - zephir fullclean 2>&1 >/dev/null && - zephir generate --backend=ZendEngine3 2>&1 >/dev/null && - test_cmp ext/lifecycle.c expected3.c -' +test_expect_success "Life Cycle Test" " + cd $FIXTURESDIR/lifecycle && + zephir fullclean 2>&1 >/dev/null && + zephir generate --backend=ZendEngine3 2>&1 >/dev/null && + test_cmp ext/lifecycle.c expected3.c +" # See: https://github.com/phalcon/zephir/issues/1758 -test_expect_success "Should generate valid code with inheritance of prototype interfaces" ' - cd $FIXTURESDIR/protodir && - zephir fullclean 2>&1 >/dev/null && - zephir generate --backend=ZendEngine3 2>&1 >/dev/null && - test_cmp ext/protodir/connectionexception.zep.h connectionexception.h -' +test_expect_success "Should generate valid code with inheritance of prototype interfaces" " + cd $FIXTURESDIR/protodir && + zephir fullclean 2>&1 >/dev/null && + zephir generate --backend=ZendEngine3 2>&1 >/dev/null && + test_cmp ext/protodir/connectionexception.zep.h connectionexception.h +" test_done diff --git a/unit-tests/sharness/t0003-init-errors.sh b/unit-tests/sharness/t0003-init-errors.sh index 71d5ad6c50..52a295aacd 100755 --- a/unit-tests/sharness/t0003-init-errors.sh +++ b/unit-tests/sharness/t0003-init-errors.sh @@ -1,18 +1,17 @@ -#!/bin/sh +#!/usr/bin/env bash -test_description="Test init command for failures" +# shellcheck disable=SC2034 +test_description="Test init commands" -. ./setup.sh +source ./setup.sh -test_expect_success "Should fail when not enough arguments" ' - cd $OUTPUTDIR && - echo "Not enough arguments (missing: \"namespace\")." >expected && - test_expect_code 1 ${PHP} ${ZEPHIR_BIN} init 2>actual && - test_cmp expected actual -' +test_expect_success "Should fail when not enough arguments" " + cd $OUTPUTDIR && + echo 'Not enough arguments (missing: \"namespace\").' >expected && + test_expect_code 1 php $ZEPHIR_BIN init 2>actual && + test_cmp expected actual +" -for f in expected actual; do - test -f $OUTPUTDIR/$f && rm -f $OUTPUTDIR/$f -done +cleanup_output "expected actual" test_done From 90b22dc7e0beaec7246b8b76ef7d74326a8070a3 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 17:41:51 +0300 Subject: [PATCH 22/38] Write errors to stderr if available --- CHANGELOG.md | 1 + Library/Console/Command/BuildCommand.php | 4 +++- Library/Console/Command/CleanCommand.php | 7 +++---- Library/Console/Command/CompileCommand.php | 2 +- Library/Console/Command/FullCleanCommand.php | 2 +- Library/Console/Command/GenerateCommand.php | 9 +++++++-- Library/Console/Command/InitCommand.php | 7 ++----- Library/Console/Command/InstallCommand.php | 6 +++--- 8 files changed, 21 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0233fdf871..b2fef0d35c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). [#1859](https://github.com/phalcon/zephir/pull/1859), [#1880](https://github.com/phalcon/zephir/pull/1880) - Rephrase help strings for common compiler options +- Write errors to stderr if available ### Removed - Remove HAVE_SPL usage diff --git a/Library/Console/Command/BuildCommand.php b/Library/Console/Command/BuildCommand.php index d75b2549b8..116b0834c7 100644 --- a/Library/Console/Command/BuildCommand.php +++ b/Library/Console/Command/BuildCommand.php @@ -16,6 +16,7 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Style\SymfonyStyle; /** * Zephir\Console\Command\BuildCommand. @@ -41,6 +42,7 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $command = $this->getApplication()->find('install'); + $io = new SymfonyStyle($input, $output); $arguments = [ 'command' => 'install', @@ -50,7 +52,7 @@ protected function execute(InputInterface $input, OutputInterface $output) try { return $command->run(new ArrayInput($arguments), $output); } catch (\Exception $e) { - $output->writeln("{$e->getMessage()}"); + $io->getErrorStyle()->error($e->getMessage()); return 1; } diff --git a/Library/Console/Command/CleanCommand.php b/Library/Console/Command/CleanCommand.php index 93a41facca..a3aaa8bb4e 100644 --- a/Library/Console/Command/CleanCommand.php +++ b/Library/Console/Command/CleanCommand.php @@ -45,7 +45,6 @@ protected function configure() protected function execute(InputInterface $input, OutputInterface $output) { $this->filesystem->clean(); - $io = new SymfonyStyle($input, $output); try { @@ -57,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output) system('cd ext && make clean > /dev/null'); } } catch (FileSystemException $e) { - $io->error( + $io->getErrorStyle()->error( sprintf( "For reasons beyond Zephir's control, a filesystem error has occurred. ". 'Please note: On Linux/Unix systems the current user must have the delete and execute '. @@ -69,11 +68,11 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } catch (\Exception $e) { - $io->error($e->getMessage()); + $io->getErrorStyle()->error($e->getMessage()); return 1; } catch (\Throwable $e) { - $io->error($e->getMessage()); + $io->getErrorStyle()->error($e->getMessage()); return 1; } diff --git a/Library/Console/Command/CompileCommand.php b/Library/Console/Command/CompileCommand.php index 0bd54b19fb..1dcba92e19 100644 --- a/Library/Console/Command/CompileCommand.php +++ b/Library/Console/Command/CompileCommand.php @@ -59,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->isDevelopmentModeEnabled($input) ); } catch (CompilerException $e) { - $io->error($e->getMessage()); + $io->getErrorStyle()->error($e->getMessage()); return 1; } diff --git a/Library/Console/Command/FullCleanCommand.php b/Library/Console/Command/FullCleanCommand.php index 36f0387f33..80c26b99c2 100644 --- a/Library/Console/Command/FullCleanCommand.php +++ b/Library/Console/Command/FullCleanCommand.php @@ -59,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } } } catch (FileSystemException $e) { - $io->error( + $io->getErrorStyle()->error( sprintf( "For reasons beyond Zephir's control, a filesystem error has occurred. ". 'Please note: On Linux/Unix systems the current user must have the delete and execute '. diff --git a/Library/Console/Command/GenerateCommand.php b/Library/Console/Command/GenerateCommand.php index 6874f4f2e4..54c2918603 100644 --- a/Library/Console/Command/GenerateCommand.php +++ b/Library/Console/Command/GenerateCommand.php @@ -17,6 +17,7 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Zephir\Compiler; +use Zephir\Exception; use Zephir\Exception\CompilerException; use Zephir\Exception\InvalidArgumentException; @@ -55,7 +56,7 @@ protected function execute(InputInterface $input, OutputInterface $output) // TODO: Move all the stuff from the compiler $this->compiler->generate(true); } catch (InvalidArgumentException $e) { - $io->error( + $io->getErrorStyle()->error( sprintf( 'Internal error: %s at %s:%d', $e->getMessage(), @@ -66,7 +67,11 @@ protected function execute(InputInterface $input, OutputInterface $output) return 1; } catch (CompilerException $e) { - $io->error($e->getMessage()); + $io->getErrorStyle()->error($e->getMessage()); + + return 1; + } catch (Exception $e) { + $io->getErrorStyle()->error($e->getMessage()); return 1; } diff --git a/Library/Console/Command/InitCommand.php b/Library/Console/Command/InitCommand.php index 62ce14ec5f..9f9c96176b 100644 --- a/Library/Console/Command/InitCommand.php +++ b/Library/Console/Command/InitCommand.php @@ -65,14 +65,11 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->config->set('namespace', $namespace); $this->config->set('name', $namespace); - if (!is_dir($namespace)) { - mkdir($namespace, 0755); + if (!is_dir("{$namespace}/{$namespace}")) { + mkdir("{$namespace}/{$namespace}", 0755, true); } chdir($namespace); - if (!is_dir($namespace)) { - mkdir($namespace, 0755); - } // Create 'kernel' if (!is_dir('ext/kernel')) { diff --git a/Library/Console/Command/InstallCommand.php b/Library/Console/Command/InstallCommand.php index 32223c1cdc..7e00a4e6a2 100644 --- a/Library/Console/Command/InstallCommand.php +++ b/Library/Console/Command/InstallCommand.php @@ -61,15 +61,15 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->isDevelopmentModeEnabled($input) ); } catch (NotImplementedException $e) { - $io->note($e->getMessage()); + $io->getErrorStyle()->note($e->getMessage()); return 0; } catch (CompilerException $e) { - $io->error($e->getMessage()); + $io->getErrorStyle()->error($e->getMessage()); return 1; } catch (Exception $e) { - $io->error($e->getMessage()); + $io->getErrorStyle()->error($e->getMessage()); return 1; } From d61e0e5f6cd84e5e288d0810e4915a92a47b167f Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 18:45:46 +0300 Subject: [PATCH 23/38] Amended tests for generate command [skip appveyor] --- CHANGELOG.md | 2 +- unit-tests/sharness/setup.sh | 24 ++++++++++++++------ unit-tests/sharness/t0001-compile.sh | 8 +++---- unit-tests/sharness/t0002-generate.sh | 12 +++++----- unit-tests/sharness/t0003-init-errors.sh | 4 ++-- unit-tests/sharness/t0004-generate-errors.sh | 18 +++++++++++++++ 6 files changed, 48 insertions(+), 20 deletions(-) create mode 100755 unit-tests/sharness/t0004-generate-errors.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index b2fef0d35c..302d5360a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +- Write errors to stderr if available ## [0.12.1] - 2019-07-30 ### Added @@ -15,7 +16,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/). [#1859](https://github.com/phalcon/zephir/pull/1859), [#1880](https://github.com/phalcon/zephir/pull/1880) - Rephrase help strings for common compiler options -- Write errors to stderr if available ### Removed - Remove HAVE_SPL usage diff --git a/unit-tests/sharness/setup.sh b/unit-tests/sharness/setup.sh index 1c88a4298f..a58d25e575 100644 --- a/unit-tests/sharness/setup.sh +++ b/unit-tests/sharness/setup.sh @@ -23,30 +23,40 @@ source "$SHARNESS_LIB" || { } if test "$TEST_VERBOSE" = 1; then - echo '# TEST_VERBOSE='"$TEST_VERBOSE" + echo '[DEBUG] TEST_VERBOSE='"$TEST_VERBOSE" fi # shellcheck disable=SC2155 -export ZEPHIRDIR=$(cd "$(dirname $0)/../../../"; pwd) +export ZEPHIRDIR=$(cd "$(dirname "$0")/../../../" || exut 1; pwd) # shellcheck disable=SC2155 -export TESTSDIR=$(cd "$(dirname $0)/../../"; pwd) +export TESTSDIR=$(cd "$(dirname "$0")/../../" || exut 1; pwd) export FIXTURESDIR="$TESTSDIR/fixtures" export OUTPUTDIR="$TESTSDIR/output" export ZEPHIR_BIN="$ZEPHIRDIR/zephir" # shellcheck disable=SC2155 export PHP_VERSION_ID=$(php -r 'echo PHP_VERSION_ID;') +: "${PHP:=$(command -v php 2>/dev/null)}" + # shellcheck disable=SC2139 -alias zephir="php $ZEPHIR_BIN" +function zephirc() { + test "$TEST_VERBOSE" = 1 && (>&1 printf "[DEBUG4] %s\n" "$PHP $ZEPHIR_BIN $*") + eval "$PHP $ZEPHIR_BIN $*" +} function cleanup_output() { [ -n "$1" ] || return 0 for f in $1; do - test -f "$OUTPUTDIR/$f" && { - test "$TEST_VERBOSE" = 1 && (>&1 printf "rm -f %s\n" "$OUTPUTDIR/$f") + if test -f "$OUTPUTDIR/$f" + then + test "$TEST_VERBOSE" = 1 && (>&1 printf "[DEBUG2] rm -f %s\n" "$OUTPUTDIR/$f") rm -f "$OUTPUTDIR/$f" - } + elif test -d "$OUTPUTDIR/$f" + then + test "$TEST_VERBOSE" = 1 && (>&1 printf "[DEBUG1] rm -rf %s\n" "$OUTPUTDIR/$f") + rm -rf "$OUTPUTDIR/${f:?}" + fi done } diff --git a/unit-tests/sharness/t0001-compile.sh b/unit-tests/sharness/t0001-compile.sh index 8572ad442d..b5d1f44483 100755 --- a/unit-tests/sharness/t0001-compile.sh +++ b/unit-tests/sharness/t0001-compile.sh @@ -8,16 +8,16 @@ source ./setup.sh regexp="'-O2 -fvisibility=hidden -Wparentheses\( -flto\)\? -DZEPHIR_RELEASE=1'" test_expect_success "Compile the extension in production mode" " cd $FIXTURESDIR/devmode && - zephir fullclean 2>&1 >/dev/null && - zephir compile --no-dev 2>&1 >/dev/null && + zephirc fullclean 2>&1 >/dev/null && + zephirc compile --no-dev 2>&1 >/dev/null && grep -q -e \"^CFLAGS=$regexp\" ext/config.nice " regexp="'-O0 -g3'" test_expect_success "Compile the extension in development mode" " cd $FIXTURESDIR/devmode && - zephir fullclean 2>&1 >/dev/null && - zephir compile --dev 2>&1 >/dev/null && + zephirc fullclean 2>&1 >/dev/null && + zephirc compile --dev 2>&1 >/dev/null && grep -q -e \"^CFLAGS=$regexp\" ext/config.nice " diff --git a/unit-tests/sharness/t0002-generate.sh b/unit-tests/sharness/t0002-generate.sh index 303aaf77bd..ea75d6e439 100755 --- a/unit-tests/sharness/t0002-generate.sh +++ b/unit-tests/sharness/t0002-generate.sh @@ -7,8 +7,8 @@ source ./setup.sh test_expect_success "Should correctly specify ARGINFO" " cd $FIXTURESDIR/typehints && - zephir fullclean 2>&1 >/dev/null && - zephir generate --backend=ZendEngine3 2>&1 >/dev/null && + zephirc fullclean 2>&1 >/dev/null && + zephirc generate --backend=ZendEngine3 2>&1 >/dev/null && test_cmp ext/typehints.c expected3.c && test_cmp ext/typehints/args.zep.h expected_args3.h && test_cmp ext/typehints/retval.zep.h expected_retval3.h && @@ -17,16 +17,16 @@ test_expect_success "Should correctly specify ARGINFO" " test_expect_success "Life Cycle Test" " cd $FIXTURESDIR/lifecycle && - zephir fullclean 2>&1 >/dev/null && - zephir generate --backend=ZendEngine3 2>&1 >/dev/null && + zephirc fullclean 2>&1 >/dev/null && + zephirc generate --backend=ZendEngine3 2>&1 >/dev/null && test_cmp ext/lifecycle.c expected3.c " # See: https://github.com/phalcon/zephir/issues/1758 test_expect_success "Should generate valid code with inheritance of prototype interfaces" " cd $FIXTURESDIR/protodir && - zephir fullclean 2>&1 >/dev/null && - zephir generate --backend=ZendEngine3 2>&1 >/dev/null && + zephirc fullclean 2>&1 >/dev/null && + zephirc generate --backend=ZendEngine3 2>&1 >/dev/null && test_cmp ext/protodir/connectionexception.zep.h connectionexception.h " diff --git a/unit-tests/sharness/t0003-init-errors.sh b/unit-tests/sharness/t0003-init-errors.sh index 52a295aacd..d8a6565fb7 100755 --- a/unit-tests/sharness/t0003-init-errors.sh +++ b/unit-tests/sharness/t0003-init-errors.sh @@ -1,14 +1,14 @@ #!/usr/bin/env bash # shellcheck disable=SC2034 -test_description="Test init commands" +test_description="Test init command for failures" source ./setup.sh test_expect_success "Should fail when not enough arguments" " cd $OUTPUTDIR && echo 'Not enough arguments (missing: \"namespace\").' >expected && - test_expect_code 1 php $ZEPHIR_BIN init 2>actual && + test_expect_code 1 zephirc init 2>actual && test_cmp expected actual " diff --git a/unit-tests/sharness/t0004-generate-errors.sh b/unit-tests/sharness/t0004-generate-errors.sh new file mode 100755 index 0000000000..633b089df0 --- /dev/null +++ b/unit-tests/sharness/t0004-generate-errors.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# shellcheck disable=SC2034 +test_description="Test generate command for failures" + +source ./setup.sh + +test_expect_success "Should fail when Zephir files to compile couldn't be found" " + cd $OUTPUTDIR && + zephirc init genfailure1 && + cd genfailure1 && + test_expect_code 1 zephirc generate --no-ansi 2>actual && + test_cmp $FIXTURESDIR/genfailure1 actual +" + +cleanup_output "genfailure1" + +test_done From 1060711a885efa4476a780d3d3a9193ddf811af4 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 19:02:49 +0300 Subject: [PATCH 24/38] Cleaned up sharness tests add fixture [skip appveyor] --- unit-tests/fixtures/genfailure1 | 4 +++ unit-tests/sharness/Makefile | 2 ++ unit-tests/sharness/setup.sh | 38 ++++++-------------- unit-tests/sharness/t0003-init-errors.sh | 2 -- unit-tests/sharness/t0004-generate-errors.sh | 2 -- 5 files changed, 16 insertions(+), 32 deletions(-) create mode 100644 unit-tests/fixtures/genfailure1 diff --git a/unit-tests/fixtures/genfailure1 b/unit-tests/fixtures/genfailure1 new file mode 100644 index 0000000000..964e8e746f --- /dev/null +++ b/unit-tests/fixtures/genfailure1 @@ -0,0 +1,4 @@ + + [ERROR] Zephir files to compile couldn't be found. Did you add a first class to + the extension? + diff --git a/unit-tests/sharness/Makefile b/unit-tests/sharness/Makefile index 1ca5f0b844..5b646ec73b 100644 --- a/unit-tests/sharness/Makefile +++ b/unit-tests/sharness/Makefile @@ -26,6 +26,8 @@ clean: clean-test-results find $(TESTSDIR)/fixtures -name compile-errors.log -o -name compile.log | xargs rm -f find $(TESTSDIR)/fixtures -name .zephir -type d | xargs rm -rf find $(TESTSDIR)/fixtures -name ext -type d | xargs rm -rf + find $(TESTSDIR)/output/* -type d | xargs rm -rf + find $(TESTSDIR)/output/* -type f -not -name .gitignore -delete -rm -rf "trash "directory.* .PHONY: clean-test-results diff --git a/unit-tests/sharness/setup.sh b/unit-tests/sharness/setup.sh index a58d25e575..5a13ecf328 100644 --- a/unit-tests/sharness/setup.sh +++ b/unit-tests/sharness/setup.sh @@ -23,40 +23,22 @@ source "$SHARNESS_LIB" || { } if test "$TEST_VERBOSE" = 1; then - echo '[DEBUG] TEST_VERBOSE='"$TEST_VERBOSE" + (>&1 printf "# TEST_VERBOSE='%s'\n" "$TEST_VERBOSE") fi -# shellcheck disable=SC2155 -export ZEPHIRDIR=$(cd "$(dirname "$0")/../../../" || exut 1; pwd) +ZEPHIRDIR=$(cd "$(dirname "$0")/../../../" || exit 1; pwd) +TESTSDIR=$(cd "$(dirname "$0")/../../" || exit 1; pwd) +export ZEPHIRDIR TESTSDIR -# shellcheck disable=SC2155 -export TESTSDIR=$(cd "$(dirname "$0")/../../" || exut 1; pwd) -export FIXTURESDIR="$TESTSDIR/fixtures" -export OUTPUTDIR="$TESTSDIR/output" -export ZEPHIR_BIN="$ZEPHIRDIR/zephir" -# shellcheck disable=SC2155 -export PHP_VERSION_ID=$(php -r 'echo PHP_VERSION_ID;') +FIXTURESDIR="$TESTSDIR/fixtures" +OUTPUTDIR="$TESTSDIR/output" +ZEPHIR_BIN="$ZEPHIRDIR/zephir" +PHP_VERSION_ID=$(php -r 'echo PHP_VERSION_ID;') +export FIXTURESDIR OUTPUTDIR ZEPHIR_BIN PHP_VERSION_ID : "${PHP:=$(command -v php 2>/dev/null)}" -# shellcheck disable=SC2139 function zephirc() { - test "$TEST_VERBOSE" = 1 && (>&1 printf "[DEBUG4] %s\n" "$PHP $ZEPHIR_BIN $*") + test "$TEST_VERBOSE" = 1 && (>&1 printf "# %s\\n" "$PHP $ZEPHIR_BIN $*") eval "$PHP $ZEPHIR_BIN $*" } - -function cleanup_output() { - [ -n "$1" ] || return 0 - - for f in $1; do - if test -f "$OUTPUTDIR/$f" - then - test "$TEST_VERBOSE" = 1 && (>&1 printf "[DEBUG2] rm -f %s\n" "$OUTPUTDIR/$f") - rm -f "$OUTPUTDIR/$f" - elif test -d "$OUTPUTDIR/$f" - then - test "$TEST_VERBOSE" = 1 && (>&1 printf "[DEBUG1] rm -rf %s\n" "$OUTPUTDIR/$f") - rm -rf "$OUTPUTDIR/${f:?}" - fi - done -} diff --git a/unit-tests/sharness/t0003-init-errors.sh b/unit-tests/sharness/t0003-init-errors.sh index d8a6565fb7..b530d2e4a8 100755 --- a/unit-tests/sharness/t0003-init-errors.sh +++ b/unit-tests/sharness/t0003-init-errors.sh @@ -12,6 +12,4 @@ test_expect_success "Should fail when not enough arguments" " test_cmp expected actual " -cleanup_output "expected actual" - test_done diff --git a/unit-tests/sharness/t0004-generate-errors.sh b/unit-tests/sharness/t0004-generate-errors.sh index 633b089df0..a203ca38ee 100755 --- a/unit-tests/sharness/t0004-generate-errors.sh +++ b/unit-tests/sharness/t0004-generate-errors.sh @@ -13,6 +13,4 @@ test_expect_success "Should fail when Zephir files to compile couldn't be found" test_cmp $FIXTURESDIR/genfailure1 actual " -cleanup_output "genfailure1" - test_done From e7dd97876b3a33f03665c49cd8e7d70734780e8b Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 19:38:04 +0300 Subject: [PATCH 25/38] Improved sharness tests [skip appveyor] --- .travis.yml | 2 +- unit-tests/sharness/Makefile | 12 ++++++------ unit-tests/sharness/t0001-compile.sh | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index eeb12a8962..d371591904 100644 --- a/.travis.yml +++ b/.travis.yml @@ -105,7 +105,7 @@ before_script: script: - zephir - .ci/run-tests.sh - - (cd unit-tests/sharness && make) + - (cd unit-tests/sharness && PHP=$(phpenv which php) make) jobs: include: diff --git a/unit-tests/sharness/Makefile b/unit-tests/sharness/Makefile index 5b646ec73b..061c8af58d 100644 --- a/unit-tests/sharness/Makefile +++ b/unit-tests/sharness/Makefile @@ -14,7 +14,7 @@ SHARNESS = $(LIBDIR)/$(SHARNESSDIR)/sharness.sh AGGREGATE = $(LIBDIR)/$(SHARNESSDIR)/aggregate-results.sh PROJECTDIR=$(LIBDIR)/../../.. -TESTSDIR=$(PROJECTDIR)/unit-tests +TESTSDIR=$(shell cd $(PROJECTDIR)/unit-tests || exit 1; pwd) BINS = $(PROJECTDIR)/zephir @@ -23,11 +23,11 @@ all: aggregate .PHONY: clean clean: clean-test-results - find $(TESTSDIR)/fixtures -name compile-errors.log -o -name compile.log | xargs rm -f - find $(TESTSDIR)/fixtures -name .zephir -type d | xargs rm -rf - find $(TESTSDIR)/fixtures -name ext -type d | xargs rm -rf - find $(TESTSDIR)/output/* -type d | xargs rm -rf - find $(TESTSDIR)/output/* -type f -not -name .gitignore -delete + find $(TESTSDIR)/fixtures -name compile-errors.log -o -name compile.log -delete + find $(TESTSDIR)/fixtures -name .zephir -type d -exec rm -rf {} + + find $(TESTSDIR)/fixtures -name ext -type d -exec rm -rf {} + + find $(TESTSDIR)/output -type d -path $(TESTSDIR)/output -prune -o -exec rm -rf {} + + find $(TESTSDIR)/output -type f -not -name .gitignore -delete -rm -rf "trash "directory.* .PHONY: clean-test-results diff --git a/unit-tests/sharness/t0001-compile.sh b/unit-tests/sharness/t0001-compile.sh index b5d1f44483..ed04045449 100755 --- a/unit-tests/sharness/t0001-compile.sh +++ b/unit-tests/sharness/t0001-compile.sh @@ -7,7 +7,7 @@ source ./setup.sh regexp="'-O2 -fvisibility=hidden -Wparentheses\( -flto\)\? -DZEPHIR_RELEASE=1'" test_expect_success "Compile the extension in production mode" " -cd $FIXTURESDIR/devmode && + cd $FIXTURESDIR/devmode && zephirc fullclean 2>&1 >/dev/null && zephirc compile --no-dev 2>&1 >/dev/null && grep -q -e \"^CFLAGS=$regexp\" ext/config.nice From 0917f9bc0ef2a66f90eeea09d11e42eb155d971f Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 22:53:17 +0300 Subject: [PATCH 26/38] Introduced initial ability to generate zend_module_deps --- CHANGELOG.md | 18 ++++++++++++++++++ Library/Compiler.php | 19 +++++++++++++++++-- Library/Config.php | 11 ++--------- templates/ZendEngine3/project.c | 7 ++++++- 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 302d5360a6..9fe649a312 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,24 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] +### Added +- Introduced initial ability to generate `zend_module_deps` by using + `requires` from project configuration (`config.json`) + [phalcon/cphalcon#13702](https://github.com/phalcon/cphalcon/issues/13702), + [phalcon/cphalcon#13794](https://github.com/phalcon/cphalcon/pull/13794). + To do so, add to your `config.json` configuration like this: + ``` + "requires": { + "extensions": [ + "module1", + "module2", + "module3" + ] + } + ``` + + +### Changed - Write errors to stderr if available ## [0.12.1] - 2019-07-30 diff --git a/Library/Compiler.php b/Library/Compiler.php index ed099370ee..c1c6b01bff 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -121,7 +121,12 @@ public function __construct( $this->stringManager = $this->backend->getStringsManager(); $this->fcallManager = $this->backend->getFcallManager(); - $this->assertRequiredExtensionsIsPresent(); + try { + $this->assertRequiredExtensionsIsPresent(); + } catch (RuntimeException $e) { + fwrite(STDERR, trim($e->getMessage()) . PHP_EOL); + exit (1); + } } /** @@ -1672,6 +1677,10 @@ public function createProjectFiles($project) } } + $modRequires = array_map(function ($mod) { + return sprintf('ZEND_MOD_REQUIRED("%s")', strtolower($mod)); + }, $this->config->get('extensions', 'requires') ?: []); + $toReplace = [ '%PROJECT_LOWER_SAFE%' => strtolower($safeProject), '%PROJECT_LOWER%' => strtolower($project), @@ -1719,6 +1728,7 @@ public function createProjectFiles($project) '%FE_HEADER%' => $feHeader, '%FE_ENTRIES%' => $feEntries, '%PROJECT_INI_ENTRIES%' => implode(PHP_EOL."\t", $initEntries), + '%PROJECT_DEPENDENCIES%' => implode(PHP_EOL."\t", $modRequires), ]; foreach ($toReplace as $mark => $replace) { $content = str_replace($mark, $replace, $content); @@ -2160,6 +2170,11 @@ private function assertRequiredExtensionsIsPresent() $extensions = []; foreach ($extensionRequires as $key => $value) { + // TODO: We'll use this as an object in the future. + // Right not it should be a string. + if (!is_string($value)) { + continue; + } if (false === \extension_loaded($value)) { $extensions[] = $value; } @@ -2168,7 +2183,7 @@ private function assertRequiredExtensionsIsPresent() if (false === empty($extensions)) { throw new RuntimeException( sprintf( - 'Could not load extension: %s. You must add extensions above before build this extension.', + 'Could not load extension(s): %s. You must load extensions above before build this extension.', implode(', ', $extensions) ) ); diff --git a/Library/Config.php b/Library/Config.php index 0645df53ce..0e71f7119c 100644 --- a/Library/Config.php +++ b/Library/Config.php @@ -24,6 +24,7 @@ class Config implements \ArrayAccess, \JsonSerializable * @var bool */ protected $changed = false; + /** * Default configuration for project. * @@ -108,7 +109,7 @@ public function __construct() $this->populate(); $this->changed = false; - $this->registerShutdownFunction(); + register_shutdown_function([$this, 'dumpToFile']); } /** @@ -327,14 +328,6 @@ public function jsonSerialize() return $this->container; } - /** - * Registers shutdown function. - */ - public function registerShutdownFunction() - { - register_shutdown_function([$this, 'dumpToFile']); - } - /** * Populate project configuration. * diff --git a/templates/ZendEngine3/project.c b/templates/ZendEngine3/project.c index bc8b2a0ef2..098fef5b0d 100644 --- a/templates/ZendEngine3/project.c +++ b/templates/ZendEngine3/project.c @@ -134,10 +134,15 @@ zend_function_entry php_%PROJECT_LOWER_SAFE%_functions[] = { %FE_ENTRIES% }; +static const zend_module_dep php_%PROJECT_LOWER_SAFE%_deps[] = { + %PROJECT_DEPENDENCIES% + ZEND_MOD_END +}; + zend_module_entry %PROJECT_LOWER_SAFE%_module_entry = { STANDARD_MODULE_HEADER_EX, NULL, - NULL, + php_%PROJECT_LOWER_SAFE%_deps, PHP_%PROJECT_UPPER%_EXTNAME, php_%PROJECT_LOWER_SAFE%_functions, PHP_MINIT(%PROJECT_LOWER%), From a43fe32a7c520b6204f2ddfc576e3b9557a03f44 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 23:03:32 +0300 Subject: [PATCH 27/38] Minor codestyle fixes --- Library/Compiler.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Library/Compiler.php b/Library/Compiler.php index c1c6b01bff..07d71b7951 100644 --- a/Library/Compiler.php +++ b/Library/Compiler.php @@ -124,8 +124,8 @@ public function __construct( try { $this->assertRequiredExtensionsIsPresent(); } catch (RuntimeException $e) { - fwrite(STDERR, trim($e->getMessage()) . PHP_EOL); - exit (1); + fwrite(STDERR, trim($e->getMessage()).PHP_EOL); + exit(1); } } @@ -2172,7 +2172,7 @@ private function assertRequiredExtensionsIsPresent() foreach ($extensionRequires as $key => $value) { // TODO: We'll use this as an object in the future. // Right not it should be a string. - if (!is_string($value)) { + if (!\is_string($value)) { continue; } if (false === \extension_loaded($value)) { From 57616381cb40d7eb804c0faa18473158dfec6995 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 23:37:45 +0300 Subject: [PATCH 28/38] Update test config --- config.json | 306 +++++++++++++++++++++++++++------------------------- 1 file changed, 158 insertions(+), 148 deletions(-) diff --git a/config.json b/config.json index 8e4e3c57bb..136fabc730 100644 --- a/config.json +++ b/config.json @@ -1,157 +1,167 @@ { - "namespace": "test", - "name": "Test Extension", - "description": "Description test forTest Extension.", - "author": "Zephir Team and contributors", - "version": "1.0.0", - "verbose": true, + "namespace": "test", + "name": "Test Extension", + "description": "Description test forTest Extension.", + "author": "Zephir Team and contributors", + "version": "1.0.0", + "verbose": true, - "stubs": { - "path": "ide\/%version%\/%namespace%\/", - "stubs-run-after-generate": false - }, + "requires": { + "extensions": [ + "PDO", + "SPL", + "standard", + "hash", + "json" + ] + }, - "api": { - "path" : "doc/%version%", - "theme" : { - "name":"zephir", - "options" :{ - "github":"https://github.com/user/repo", - "analytics":null, - "main_color": "#3E6496", - "link_color": "#3E6496", - "link_hover_color": "#5F9AE7" - } - } - }, + "stubs": { + "path": "ide\/%version%\/%namespace%\/", + "stubs-run-after-generate": false + }, - "warnings": { - "unused-variable": true, - "unused-variable-external": false, - "possible-wrong-parameter": true, - "possible-wrong-parameter-undefined": false, - "nonexistent-function": true, - "nonexistent-class": true, - "non-valid-isset": true, - "non-array-update": true, - "non-valid-objectupdate": true, - "non-valid-fetch": true, - "invalid-array-index": true, - "non-array-append": true, - "invalid-return-type": true, - "unreachable-code": true, - "nonexistent-constant": true, - "not-supported-magic-constant": true, - "non-valid-decrement": true, - "non-valid-increment": true, - "non-valid-clone": true, - "non-valid-new": true, - "non-array-access": true, - "invalid-reference": true, - "invalid-typeof-comparison": true, - "conditional-initialization": true - }, + "api": { + "path" : "doc/%version%", + "theme" : { + "name":"zephir", + "options" :{ + "github":"https://github.com/user/repo", + "analytics":null, + "main_color": "#3E6496", + "link_color": "#3E6496", + "link_hover_color": "#5F9AE7" + } + } + }, - "optimizations": { - "static-type-inference": true, - "static-type-inference-second-pass": true, - "local-context-pass": true, - "constant-folding": true, - "static-constant-class-folding": true, - "call-gatherer-pass": true, - "check-invalid-reads": false, - "private-internal-methods": false, - "public-internal-methods": false, - "public-internal-functions": true - }, + "warnings": { + "unused-variable": true, + "unused-variable-external": false, + "possible-wrong-parameter": true, + "possible-wrong-parameter-undefined": false, + "nonexistent-function": true, + "nonexistent-class": true, + "non-valid-isset": true, + "non-array-update": true, + "non-valid-objectupdate": true, + "non-valid-fetch": true, + "invalid-array-index": true, + "non-array-append": true, + "invalid-return-type": true, + "unreachable-code": true, + "nonexistent-constant": true, + "not-supported-magic-constant": true, + "non-valid-decrement": true, + "non-valid-increment": true, + "non-valid-clone": true, + "non-valid-new": true, + "non-array-access": true, + "invalid-reference": true, + "invalid-typeof-comparison": true, + "conditional-initialization": true + }, - "globals": { - "my_setting_1": { - "type": "bool", - "default": true, - "ini-entry": { - "name": "ini-entry.my_setting_1", - "scope": "PHP_INI_ALL" - } - }, - "test_setting_1": { - "type": "bool", - "default": true - }, - "my_setting_2": { - "type": "int", - "default": 10 - }, - "my_setting_3": { - "type": "double", - "default": 15.2 - }, - "my_setting_4": { - "type": "char", - "default": "A" - }, - "db.my_setting_1": { - "type": "bool", - "default": false - }, - "db.my_setting_2": { - "type": "int", - "default": 100 - }, - "db.my_setting_3": { - "type": "double", - "default": 7.5 - }, - "orm.cache_level": { - "type": "int", - "default": 3 - }, - "orm.cache_enable": { - "type": "bool", - "default": true - }, - "extension.test_ini_variable": { - "type": "bool", - "default": true, - "ini-entry": { - "name": "extension.test_ini_variable", - "scope": "PHP_INI_ALL" - } - } + "optimizations": { + "static-type-inference": true, + "static-type-inference-second-pass": true, + "local-context-pass": true, + "constant-folding": true, + "static-constant-class-folding": true, + "call-gatherer-pass": true, + "check-invalid-reads": false, + "private-internal-methods": false, + "public-internal-methods": false, + "public-internal-functions": true + }, + + "globals": { + "my_setting_1": { + "type": "bool", + "default": true, + "ini-entry": { + "name": "ini-entry.my_setting_1", + "scope": "PHP_INI_ALL" + } + }, + "test_setting_1": { + "type": "bool", + "default": true + }, + "my_setting_2": { + "type": "int", + "default": 10 + }, + "my_setting_3": { + "type": "double", + "default": 15.2 }, + "my_setting_4": { + "type": "char", + "default": "A" + }, + "db.my_setting_1": { + "type": "bool", + "default": false + }, + "db.my_setting_2": { + "type": "int", + "default": 100 + }, + "db.my_setting_3": { + "type": "double", + "default": 7.5 + }, + "orm.cache_level": { + "type": "int", + "default": 3 + }, + "orm.cache_enable": { + "type": "bool", + "default": true + }, + "extension.test_ini_variable": { + "type": "bool", + "default": true, + "ini-entry": { + "name": "extension.test_ini_variable", + "scope": "PHP_INI_ALL" + } + } + }, - "info": [ - { - "header": [ - "Test Extension support", - "Value" - ], - "rows": [ - [ - "Lifecycle hooks", - "PHP provides several lifecycle events, which extensions can use to perform common initialization or shutdown tasks." - ], - [ - "Static Analysis", - "Test extensions' compiler provides static analysis of the compiled code." - ] - ] - }, - { - "header": [ - "Test variable", - "Value" - ], - "rows": [ - [ - "Extension", - "Installed" - ], - [ - "NFR", - "Contributions are welcome!" - ] - ] - } - ] + "info": [ + { + "header": [ + "Test Extension support", + "Value" + ], + "rows": [ + [ + "Lifecycle hooks", + "PHP provides several lifecycle events, which extensions can use to perform common initialization or shutdown tasks." + ], + [ + "Static Analysis", + "Test extensions' compiler provides static analysis of the compiled code." + ] + ] + }, + { + "header": [ + "Test variable", + "Value" + ], + "rows": [ + [ + "Extension", + "Installed" + ], + [ + "NFR", + "Contributions are welcome!" + ] + ] + } + ] } From a7ed664d7f3b52f58d39965ac90bd27636c834ce Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 23:38:17 +0300 Subject: [PATCH 29/38] Regenerate ext --- ext/test.c | 11 ++++++++- ext/test/oo/oodestruct.zep.c | 32 ++++++++++++------------- ext/test/optimizers/strreplace.zep.c | 2 +- ext/test/properties/propertyarray.zep.c | 6 ++--- ext/test/quantum.zep.c | 4 ++-- ext/test/range.zep.c | 4 ++-- ext/test/regexdna.zep.c | 4 ++-- ext/test/requires.zep.c | 2 +- ext/test/requires/external3.zep.c | 4 ++-- ext/test/resourcetest.zep.c | 2 +- ext/test/router.zep.c | 6 ++--- ext/test/scall.zep.c | 8 +++---- ext/test/scope.zep.c | 4 ++-- ext/test/sort.zep.c | 6 ++--- ext/test/spectralnorm.zep.c | 32 ++++++++++++------------- ext/test/strings.zep.c | 8 +++---- ext/test/trytest.zep.c | 12 +++++----- 17 files changed, 77 insertions(+), 70 deletions(-) diff --git a/ext/test.c b/ext/test.c index 862bc262fd..c5ff5316f9 100644 --- a/ext/test.c +++ b/ext/test.c @@ -581,10 +581,19 @@ ZEND_FE_END }; +static const zend_module_dep php_test_deps[] = { + ZEND_MOD_REQUIRED("pdo") + ZEND_MOD_REQUIRED("spl") + ZEND_MOD_REQUIRED("standard") + ZEND_MOD_REQUIRED("hash") + ZEND_MOD_REQUIRED("json") + ZEND_MOD_END +}; + zend_module_entry test_module_entry = { STANDARD_MODULE_HEADER_EX, NULL, - NULL, + php_test_deps, PHP_TEST_EXTNAME, php_test_functions, PHP_MINIT(test), diff --git a/ext/test/oo/oodestruct.zep.c b/ext/test/oo/oodestruct.zep.c index d99776b38e..5caf6f93be 100644 --- a/ext/test/oo/oodestruct.zep.c +++ b/ext/test/oo/oodestruct.zep.c @@ -160,8 +160,9 @@ PHP_METHOD(Test_Oo_OoDestruct, __construct) { zend_bool _30$$13; zend_class_entry *_26$$11 = NULL, *_22$$12 = NULL, *_32$$14 = NULL; zephir_method_globals *ZEPHIR_METHOD_GLOBALS_PTR = NULL; + zephir_fcall_cache_entry *_29 = NULL; zend_long width, height, ZEPHIR_LAST_CALL_STATUS; - zval *file_param = NULL, *width_param = NULL, *height_param = NULL, __$true, imageinfo, _0, _1, _2$$4, _3$$4, _4$$4, _9$$4, _28$$4, _29$$4, _5$$5, _6$$5, _7$$5, _8$$5, _10$$6, _11$$6, _12$$7, _13$$7, _14$$8, _15$$8, _16$$9, _17$$9, _18$$10, _19$$10, _20$$11, _25$$11, _27$$11, _21$$12, _23$$12, _24$$12, _35$$13, _36$$13, _37$$13, _38$$13, _39$$13, _40$$13, _31$$14, _33$$14, _34$$14; + zval *file_param = NULL, *width_param = NULL, *height_param = NULL, __$true, imageinfo, _0, _1, _2$$4, _3$$4, _4$$4, _9$$4, _28$$4, _5$$5, _6$$5, _7$$5, _8$$5, _10$$6, _11$$6, _12$$7, _13$$7, _14$$8, _15$$8, _16$$9, _17$$9, _18$$10, _19$$10, _20$$11, _25$$11, _27$$11, _21$$12, _23$$12, _24$$12, _35$$13, _36$$13, _37$$13, _38$$13, _39$$13, _40$$13, _31$$14, _33$$14, _34$$14; zval file; zval *this_ptr = getThis(); @@ -175,7 +176,6 @@ PHP_METHOD(Test_Oo_OoDestruct, __construct) { ZVAL_UNDEF(&_4$$4); ZVAL_UNDEF(&_9$$4); ZVAL_UNDEF(&_28$$4); - ZVAL_UNDEF(&_29$$4); ZVAL_UNDEF(&_5$$5); ZVAL_UNDEF(&_6$$5); ZVAL_UNDEF(&_7$$5); @@ -260,35 +260,35 @@ PHP_METHOD(Test_Oo_OoDestruct, __construct) { do { if (ZEPHIR_IS_LONG(&_9$$4, 1)) { zephir_read_property(&_10$$6, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_11$$6, "imagecreatefromgif", NULL, 0, &_10$$6); + ZEPHIR_CALL_FUNCTION(&_11$$6, "imagecreatefromgif", NULL, 59, &_10$$6); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_11$$6); break; } if (ZEPHIR_IS_LONG(&_9$$4, 2)) { zephir_read_property(&_12$$7, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_13$$7, "imagecreatefromjpeg", NULL, 0, &_12$$7); + ZEPHIR_CALL_FUNCTION(&_13$$7, "imagecreatefromjpeg", NULL, 60, &_12$$7); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_13$$7); break; } if (ZEPHIR_IS_LONG(&_9$$4, 3)) { zephir_read_property(&_14$$8, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_15$$8, "imagecreatefrompng", NULL, 0, &_14$$8); + ZEPHIR_CALL_FUNCTION(&_15$$8, "imagecreatefrompng", NULL, 61, &_14$$8); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_15$$8); break; } if (ZEPHIR_IS_LONG(&_9$$4, 15)) { zephir_read_property(&_16$$9, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_17$$9, "imagecreatefromwbmp", NULL, 0, &_16$$9); + ZEPHIR_CALL_FUNCTION(&_17$$9, "imagecreatefromwbmp", NULL, 62, &_16$$9); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_17$$9); break; } if (ZEPHIR_IS_LONG(&_9$$4, 16)) { zephir_read_property(&_18$$10, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(&_19$$10, "imagecreatefromxbm", NULL, 0, &_18$$10); + ZEPHIR_CALL_FUNCTION(&_19$$10, "imagecreatefromxbm", NULL, 63, &_18$$10); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_19$$10); break; @@ -328,8 +328,7 @@ PHP_METHOD(Test_Oo_OoDestruct, __construct) { } while(0); zephir_read_property(&_28$$4, this_ptr, SL("image"), PH_NOISY_CC | PH_READONLY); - ZVAL_BOOL(&_29$$4, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, &_28$$4, &_29$$4); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_29, 64, &_28$$4, &__$true); zephir_check_call_status(); } else { _30$$13 = !width; @@ -355,15 +354,14 @@ PHP_METHOD(Test_Oo_OoDestruct, __construct) { } ZVAL_LONG(&_35$$13, width); ZVAL_LONG(&_36$$13, height); - ZEPHIR_CALL_FUNCTION(&_37$$13, "imagecreatetruecolor", NULL, 0, &_35$$13, &_36$$13); + ZEPHIR_CALL_FUNCTION(&_37$$13, "imagecreatetruecolor", NULL, 65, &_35$$13, &_36$$13); zephir_check_call_status(); zephir_update_property_zval(this_ptr, SL("image"), &_37$$13); zephir_read_property(&_35$$13, this_ptr, SL("image"), PH_NOISY_CC | PH_READONLY); - ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 59, &_35$$13, &__$true); + ZEPHIR_CALL_FUNCTION(NULL, "imagealphablending", NULL, 66, &_35$$13, &__$true); zephir_check_call_status(); zephir_read_property(&_36$$13, this_ptr, SL("image"), PH_NOISY_CC | PH_READONLY); - ZVAL_BOOL(&_38$$13, 1); - ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", NULL, 0, &_36$$13, &_38$$13); + ZEPHIR_CALL_FUNCTION(NULL, "imagesavealpha", &_29, 64, &_36$$13, &__$true); zephir_check_call_status(); zephir_read_property(&_38$$13, this_ptr, SL("file"), PH_NOISY_CC | PH_READONLY); zephir_update_property_zval(this_ptr, SL("realpath"), &_38$$13); @@ -400,7 +398,7 @@ PHP_METHOD(Test_Oo_OoDestruct, __destruct) { zephir_read_property(&_0, this_ptr, SL("image"), PH_NOISY_CC | PH_READONLY); ZEPHIR_CPY_WRT(&image, &_0); if (Z_TYPE_P(&image) == IS_RESOURCE) { - ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 0, &image); + ZEPHIR_CALL_FUNCTION(NULL, "imagedestroy", NULL, 67, &image); zephir_check_call_status(); } ZEPHIR_MM_RESTORE(); @@ -455,7 +453,7 @@ PHP_METHOD(Test_Oo_OoDestruct, check) { ZVAL_STRING(&_4, "2.0.1"); ZEPHIR_INIT_VAR(&_5); ZVAL_STRING(&_5, ">="); - ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 60, &version, &_4, &_5); + ZEPHIR_CALL_FUNCTION(&_6, "version_compare", NULL, 68, &version, &_4, &_5); zephir_check_call_status(); if (UNEXPECTED(!zephir_is_true(&_6))) { ZEPHIR_INIT_VAR(&_7$$5); @@ -521,13 +519,13 @@ PHP_METHOD(Test_Oo_OoDestruct, getVersion) { ZVAL_NULL(&version); ZEPHIR_INIT_VAR(&_3); ZVAL_STRING(&_3, "GD_VERSION"); - ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 61, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "defined", NULL, 69, &_3); zephir_check_call_status(); if (zephir_is_true(&_4)) { ZEPHIR_INIT_NVAR(&version); ZEPHIR_MM_GET_CONSTANT(&version, "GD_VERSION"); } else { - ZEPHIR_CALL_FUNCTION(&info, "gd_info", NULL, 62); + ZEPHIR_CALL_FUNCTION(&info, "gd_info", NULL, 70); zephir_check_call_status(); ZEPHIR_INIT_VAR(&matches); ZVAL_NULL(&matches); diff --git a/ext/test/optimizers/strreplace.zep.c b/ext/test/optimizers/strreplace.zep.c index c4f5b8ad9d..55d802bcab 100644 --- a/ext/test/optimizers/strreplace.zep.c +++ b/ext/test/optimizers/strreplace.zep.c @@ -209,7 +209,7 @@ PHP_METHOD(Test_Optimizers_StrReplace, issue732B) { zephir_array_fast_append(&replacements, &_0); ZEPHIR_INIT_VAR(&subject); ZVAL_STRING(&subject, "The quick brown fox jumped over the lazy dog."); - ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 63, &patterns, &replacements, &subject); + ZEPHIR_RETURN_CALL_FUNCTION("preg_replace", NULL, 71, &patterns, &replacements, &subject); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/properties/propertyarray.zep.c b/ext/test/properties/propertyarray.zep.c index e90e065f12..62a76b8be1 100644 --- a/ext/test/properties/propertyarray.zep.c +++ b/ext/test/properties/propertyarray.zep.c @@ -138,12 +138,12 @@ PHP_METHOD(Test_Properties_PropertyArray, testIssues1831) { } zephir_read_property(&_0$$3, this_ptr, SL("otherArray"), PH_NOISY_CC | PH_READONLY); ZEPHIR_MAKE_REF(&_0$$3); - ZEPHIR_CALL_FUNCTION(&info, "array_shift", &_1, 64, &_0$$3); + ZEPHIR_CALL_FUNCTION(&info, "array_shift", &_1, 72, &_0$$3); ZEPHIR_UNREF(&_0$$3); zephir_check_call_status(); ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRING(&_2$$3, "header"); - ZEPHIR_CALL_FUNCTION(&_3$$3, "stripos", &_4, 65, &info, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "stripos", &_4, 73, &info, &_2$$3); zephir_check_call_status(); if (!ZEPHIR_IS_FALSE_IDENTICAL(&_3$$3)) { zephir_array_append(&headers, &info, PH_SEPARATE, "test/properties/propertyarray.zep", 51); @@ -151,7 +151,7 @@ PHP_METHOD(Test_Properties_PropertyArray, testIssues1831) { } else { zephir_read_property(&_5$$5, this_ptr, SL("otherArray"), PH_NOISY_CC | PH_READONLY); ZEPHIR_MAKE_REF(&_5$$5); - ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", &_6, 66, &_5$$5, &info); + ZEPHIR_CALL_FUNCTION(NULL, "array_unshift", &_6, 74, &_5$$5, &info); ZEPHIR_UNREF(&_5$$5); zephir_check_call_status(); break; diff --git a/ext/test/quantum.zep.c b/ext/test/quantum.zep.c index 7a6fcced26..69144a6bae 100644 --- a/ext/test/quantum.zep.c +++ b/ext/test/quantum.zep.c @@ -340,13 +340,13 @@ PHP_METHOD(Test_Quantum, harmos) { ZVAL_STRING(&_52$$9, "%16.8lf %16.8lf %16.8lf \n"); ZVAL_DOUBLE(&_53$$9, ((double) i * dx)); ZVAL_DOUBLE(&_54$$9, ((double) n * dt)); - ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 67, &fp, &_52$$9, &_53$$9, &_54$$9, &_51$$9); + ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 75, &fp, &_52$$9, &_53$$9, &_54$$9, &_51$$9); zephir_check_call_status(); i = (i + 10); } ZEPHIR_INIT_NVAR(&_56$$8); ZVAL_STRING(&_56$$8, "\n"); - ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 67, &fp, &_56$$8); + ZEPHIR_CALL_FUNCTION(NULL, "fprintf", &_55, 75, &fp, &_56$$8); zephir_check_call_status(); } j = 1; diff --git a/ext/test/range.zep.c b/ext/test/range.zep.c index b98db53ff8..41627af095 100644 --- a/ext/test/range.zep.c +++ b/ext/test/range.zep.c @@ -46,7 +46,7 @@ PHP_METHOD(Test_Range, inclusive1) { ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 10); - ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 68, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 76, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(&_3, &_2); RETURN_CTOR(&_3); @@ -70,7 +70,7 @@ PHP_METHOD(Test_Range, exclusive1) { ZVAL_LONG(&_0, 0); ZVAL_LONG(&_1, 10); - ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 68, &_0, &_1); + ZEPHIR_CALL_FUNCTION(&_2, "range", NULL, 76, &_0, &_1); zephir_check_call_status(); zephir_get_arrval(&_3, &_2); RETURN_CTOR(&_3); diff --git a/ext/test/regexdna.zep.c b/ext/test/regexdna.zep.c index 1cfedbab57..50d1ca49ef 100644 --- a/ext/test/regexdna.zep.c +++ b/ext/test/regexdna.zep.c @@ -179,7 +179,7 @@ PHP_METHOD(Test_RegexDNA, process) { ZEPHIR_CONCAT_SVS(&_1, "/", &stuffToRemove, "/mS"); ZEPHIR_INIT_NVAR(&_0); ZVAL_STRING(&_0, ""); - ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 63, &_1, &_0, &contents); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 71, &_1, &_0, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); ZEPHIR_INIT_VAR(&codeLength); @@ -223,7 +223,7 @@ PHP_METHOD(Test_RegexDNA, process) { } } ZEPHIR_INIT_NVAR(®ex); - ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 63, &vIUB, &vIUBnew, &contents); + ZEPHIR_CALL_FUNCTION(&_2, "preg_replace", &_3, 71, &vIUB, &vIUBnew, &contents); zephir_check_call_status(); ZEPHIR_CPY_WRT(&contents, &_2); php_printf("%c", '\n'); diff --git a/ext/test/requires.zep.c b/ext/test/requires.zep.c index 9868083497..d491228a9a 100644 --- a/ext/test/requires.zep.c +++ b/ext/test/requires.zep.c @@ -96,7 +96,7 @@ PHP_METHOD(Test_Requires, requireExternal3) { ZEPHIR_CALL_METHOD(NULL, &external3, "__construct", NULL, 0); zephir_check_call_status(); } - ZEPHIR_CALL_METHOD(NULL, &external3, "req", NULL, 69, path, this_ptr); + ZEPHIR_CALL_METHOD(NULL, &external3, "req", NULL, 77, path, this_ptr); zephir_check_call_status(); RETURN_MM_MEMBER(getThis(), "content"); diff --git a/ext/test/requires/external3.zep.c b/ext/test/requires/external3.zep.c index af1e6dd62b..13d93c334c 100644 --- a/ext/test/requires/external3.zep.c +++ b/ext/test/requires/external3.zep.c @@ -47,12 +47,12 @@ PHP_METHOD(Test_Requires_External3, req) { - ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 70); + ZEPHIR_CALL_FUNCTION(NULL, "ob_clean", NULL, 78); zephir_check_call_status(); if (zephir_require_zval(path TSRMLS_CC) == FAILURE) { RETURN_MM_NULL(); } - ZEPHIR_CALL_FUNCTION(&_0, "ob_get_contents", NULL, 71); + ZEPHIR_CALL_FUNCTION(&_0, "ob_get_contents", NULL, 79); zephir_check_call_status(); ZEPHIR_CALL_METHOD(NULL, requires, "setcontent", NULL, 0, &_0); zephir_check_call_status(); diff --git a/ext/test/resourcetest.zep.c b/ext/test/resourcetest.zep.c index 3d345b083f..90bc869861 100644 --- a/ext/test/resourcetest.zep.c +++ b/ext/test/resourcetest.zep.c @@ -123,7 +123,7 @@ PHP_METHOD(Test_ResourceTest, testFunctionsForSTDIN) { ZEPHIR_INIT_VAR(&a); ZEPHIR_MM_GET_CONSTANT(&a, "STDIN"); ZVAL_LONG(&_0, 1); - ZEPHIR_CALL_FUNCTION(NULL, "stream_set_blocking", NULL, 72, &a, &_0); + ZEPHIR_CALL_FUNCTION(NULL, "stream_set_blocking", NULL, 80, &a, &_0); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); diff --git a/ext/test/router.zep.c b/ext/test/router.zep.c index d17d7582c9..37029466a6 100644 --- a/ext/test/router.zep.c +++ b/ext/test/router.zep.c @@ -139,7 +139,7 @@ PHP_METHOD(Test_Router, __construct) { add_assoc_long_ex(&_1$$3, SL("controller"), 1); ZEPHIR_INIT_VAR(&_2$$3); ZVAL_STRING(&_2$$3, "#^/([a-zA-Z0-9\\_\\-]+)[/]{0,1}$#"); - ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", &_3, 73, &_2$$3, &_1$$3); + ZEPHIR_CALL_METHOD(NULL, &_0$$3, "__construct", &_3, 81, &_2$$3, &_1$$3); zephir_check_call_status(); zephir_array_append(&routes, &_0$$3, PH_SEPARATE, "test/router.zep", 89); ZEPHIR_INIT_NVAR(&_2$$3); @@ -151,7 +151,7 @@ PHP_METHOD(Test_Router, __construct) { add_assoc_long_ex(&_4$$3, SL("params"), 3); ZEPHIR_INIT_VAR(&_5$$3); ZVAL_STRING(&_5$$3, "#^/([a-zA-Z0-9\\_\\-]+)/([a-zA-Z0-9\\.\\_]+)(/.*)*$#"); - ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 73, &_5$$3, &_4$$3); + ZEPHIR_CALL_METHOD(NULL, &_2$$3, "__construct", &_3, 81, &_5$$3, &_4$$3); zephir_check_call_status(); zephir_array_append(&routes, &_2$$3, PH_SEPARATE, "test/router.zep", 95); } @@ -1036,7 +1036,7 @@ PHP_METHOD(Test_Router, add) { ZEPHIR_INIT_VAR(&route); object_init_ex(&route, test_router_route_ce); - ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 73, pattern, paths, httpMethods); + ZEPHIR_CALL_METHOD(NULL, &route, "__construct", NULL, 81, pattern, paths, httpMethods); zephir_check_call_status(); zephir_update_property_array_append(this_ptr, SL("_routes"), &route); RETURN_CCTOR(&route); diff --git a/ext/test/scall.zep.c b/ext/test/scall.zep.c index 031970d7d7..24e7e92aa7 100644 --- a/ext/test/scall.zep.c +++ b/ext/test/scall.zep.c @@ -157,7 +157,7 @@ PHP_METHOD(Test_Scall, testCall3) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 74); + ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 82); zephir_check_call_status(); RETURN_MM(); @@ -221,7 +221,7 @@ PHP_METHOD(Test_Scall, testCall6) { - ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 75, a, b); + ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 83, a, b); zephir_check_call_status(); RETURN_MM(); @@ -267,7 +267,7 @@ PHP_METHOD(Test_Scall, testCall9) { ZEPHIR_MM_GROW(); - ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 74); + ZEPHIR_RETURN_CALL_SELF("testmethod3", &_0, 82); zephir_check_call_status(); RETURN_MM(); @@ -331,7 +331,7 @@ PHP_METHOD(Test_Scall, testCall12) { - ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 75, a, b); + ZEPHIR_RETURN_CALL_SELF("testmethod6", &_0, 83, a, b); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/scope.zep.c b/ext/test/scope.zep.c index 8eea743461..fb7b3914e9 100644 --- a/ext/test/scope.zep.c +++ b/ext/test/scope.zep.c @@ -73,7 +73,7 @@ PHP_METHOD(Test_Scope, test1) { ZEPHIR_INIT_VAR(&ret); ZVAL_STRING(&ret, ""); - ZEPHIR_CALL_SELF(&k, "getstr", &_0, 76); + ZEPHIR_CALL_SELF(&k, "getstr", &_0, 84); zephir_check_call_status(); r = 1; if (r == 1) { @@ -169,7 +169,7 @@ PHP_METHOD(Test_Scope, test3) { } ZEPHIR_INIT_NVAR(&c); ZVAL_LONG(&c, _1); - ZEPHIR_CALL_SELF(&str$$3, "getdystr", &_3, 77, &c); + ZEPHIR_CALL_SELF(&str$$3, "getdystr", &_3, 85, &c); zephir_check_call_status(); zephir_concat_self(&k, &str$$3 TSRMLS_CC); } diff --git a/ext/test/sort.zep.c b/ext/test/sort.zep.c index 15b73c58ab..ce72fb93c8 100644 --- a/ext/test/sort.zep.c +++ b/ext/test/sort.zep.c @@ -94,16 +94,16 @@ PHP_METHOD(Test_Sort, quick) { } } } - ZEPHIR_CALL_METHOD(&_7, this_ptr, "quick", &_8, 78, &left); + ZEPHIR_CALL_METHOD(&_7, this_ptr, "quick", &_8, 86, &left); zephir_check_call_status(); ZEPHIR_INIT_VAR(&_9); zephir_create_array(&_9, 1, 0 TSRMLS_CC); ZEPHIR_INIT_VAR(&_10); ZVAL_LONG(&_10, pivot); zephir_array_fast_append(&_9, &_10); - ZEPHIR_CALL_METHOD(&_11, this_ptr, "quick", &_8, 78, &right); + ZEPHIR_CALL_METHOD(&_11, this_ptr, "quick", &_8, 86, &right); zephir_check_call_status(); - ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 79, &_7, &_9, &_11); + ZEPHIR_RETURN_CALL_FUNCTION("array_merge", NULL, 87, &_7, &_9, &_11); zephir_check_call_status(); RETURN_MM(); diff --git a/ext/test/spectralnorm.zep.c b/ext/test/spectralnorm.zep.c index eae4e1a5f6..b6f93e2b7e 100644 --- a/ext/test/spectralnorm.zep.c +++ b/ext/test/spectralnorm.zep.c @@ -113,7 +113,7 @@ PHP_METHOD(Test_SpectralNorm, Au) { j = _4$$3; ZVAL_LONG(&_7$$4, i); ZVAL_LONG(&_8$$4, j); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 80, &_7$$4, &_8$$4); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 88, &_7$$4, &_8$$4); zephir_check_call_status(); ZVAL_LONG(&_7$$4, j); ZEPHIR_CALL_METHOD(&_10$$4, u, "offsetget", &_11, 0, &_7$$4); @@ -189,7 +189,7 @@ PHP_METHOD(Test_SpectralNorm, Atu) { j = _4$$3; ZVAL_LONG(&_7$$4, j); ZVAL_LONG(&_8$$4, i); - ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 80, &_7$$4, &_8$$4); + ZEPHIR_CALL_METHOD(&_6$$4, this_ptr, "ax", &_9, 88, &_7$$4, &_8$$4); zephir_check_call_status(); ZVAL_LONG(&_7$$4, j); ZEPHIR_CALL_METHOD(&_10$$4, u, "offsetget", &_11, 0, &_7$$4); @@ -226,9 +226,9 @@ PHP_METHOD(Test_SpectralNorm, AtAu) { - ZEPHIR_CALL_METHOD(NULL, this_ptr, "au", NULL, 81, n, u, w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "au", NULL, 89, n, u, w); zephir_check_call_status(); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atu", NULL, 82, n, w, v); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atu", NULL, 90, n, w, v); zephir_check_call_status(); ZEPHIR_MM_RESTORE(); @@ -267,17 +267,17 @@ PHP_METHOD(Test_SpectralNorm, process) { ZEPHIR_INIT_VAR(&u); object_init_ex(&u, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &u, "__construct", NULL, 83, &_0); + ZEPHIR_CALL_METHOD(NULL, &u, "__construct", NULL, 91, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&v); object_init_ex(&v, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &v, "__construct", NULL, 83, &_0); + ZEPHIR_CALL_METHOD(NULL, &v, "__construct", NULL, 91, &_0); zephir_check_call_status(); ZEPHIR_INIT_VAR(&w); object_init_ex(&w, spl_ce_SplFixedArray); ZVAL_LONG(&_0, n); - ZEPHIR_CALL_METHOD(NULL, &w, "__construct", NULL, 83, &_0); + ZEPHIR_CALL_METHOD(NULL, &w, "__construct", NULL, 91, &_0); zephir_check_call_status(); _3 = (n - 1); _2 = 0; @@ -295,15 +295,15 @@ PHP_METHOD(Test_SpectralNorm, process) { i = _2; ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &u, "offsetset", &_6, 84, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &u, "offsetset", &_6, 92, &_4$$3, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &v, "offsetset", &_6, 84, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &v, "offsetset", &_6, 92, &_4$$3, &_5$$3); zephir_check_call_status(); ZVAL_LONG(&_4$$3, i); ZVAL_LONG(&_5$$3, 1); - ZEPHIR_CALL_METHOD(NULL, &w, "offsetset", &_6, 84, &_4$$3, &_5$$3); + ZEPHIR_CALL_METHOD(NULL, &w, "offsetset", &_6, 92, &_4$$3, &_5$$3); zephir_check_call_status(); } } @@ -322,10 +322,10 @@ PHP_METHOD(Test_SpectralNorm, process) { } i = _8; ZVAL_LONG(&_10$$4, n); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 85, &_10$$4, &u, &v, &w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 93, &_10$$4, &u, &v, &w); zephir_check_call_status(); ZVAL_LONG(&_10$$4, n); - ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 85, &_10$$4, &v, &u, &w); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "atau", &_11, 93, &_10$$4, &v, &u, &w); zephir_check_call_status(); } } @@ -344,19 +344,19 @@ PHP_METHOD(Test_SpectralNorm, process) { } i = _13; ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_15$$5, &u, "offsetget", &_17, 86, &_16$$5); + ZEPHIR_CALL_METHOD(&_15$$5, &u, "offsetget", &_17, 94, &_16$$5); zephir_check_call_status(); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 86, &_16$$5); + ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 94, &_16$$5); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_19$$5); mul_function(&_19$$5, &_15$$5, &_18$$5 TSRMLS_CC); vBv += zephir_get_numberval(&_19$$5); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_15$$5, &v, "offsetget", &_17, 86, &_16$$5); + ZEPHIR_CALL_METHOD(&_15$$5, &v, "offsetget", &_17, 94, &_16$$5); zephir_check_call_status(); ZVAL_LONG(&_16$$5, i); - ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 86, &_16$$5); + ZEPHIR_CALL_METHOD(&_18$$5, &v, "offsetget", &_17, 94, &_16$$5); zephir_check_call_status(); ZEPHIR_INIT_LNVAR(_20$$5); mul_function(&_20$$5, &_15$$5, &_18$$5 TSRMLS_CC); diff --git a/ext/test/strings.zep.c b/ext/test/strings.zep.c index 3b6240d60b..fadec1075f 100644 --- a/ext/test/strings.zep.c +++ b/ext/test/strings.zep.c @@ -545,7 +545,7 @@ PHP_METHOD(Test_Strings, strToHex) { _1$$3 = ZEPHIR_STRING_OFFSET(&value, i); ZEPHIR_INIT_NVAR(&_2$$3); ZVAL_STRINGL(&_2$$3, &_1$$3, 1); - ZEPHIR_CALL_FUNCTION(&_3$$3, "ord", &_4, 87, &_2$$3); + ZEPHIR_CALL_FUNCTION(&_3$$3, "ord", &_4, 95, &_2$$3); zephir_check_call_status(); ZEPHIR_CALL_FUNCTION(&_5$$3, "dechex", &_6, 10, &_3$$3); zephir_check_call_status(); @@ -598,17 +598,17 @@ PHP_METHOD(Test_Strings, issue1267) { zephir_fast_str_replace(&_0, &_1, &_2, value TSRMLS_CC); ZEPHIR_CPY_WRT(value, &_0); ZVAL_LONG(&_3, 513); - ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 88, value, &_3); + ZEPHIR_CALL_FUNCTION(&_4, "filter_var", NULL, 96, value, &_3); zephir_check_call_status(); ZEPHIR_CPY_WRT(value, &_4); ZEPHIR_INIT_NVAR(&_0); - ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 89, value); + ZEPHIR_CALL_FUNCTION(&_4, "strip_tags", &_5, 97, value); zephir_check_call_status(); zephir_stripslashes(&_0, &_4); ZEPHIR_INIT_VAR(&x); zephir_fast_trim(&x, &_0, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); ZEPHIR_INIT_VAR(&_6); - ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 89, value); + ZEPHIR_CALL_FUNCTION(&_7, "strip_tags", &_5, 97, value); zephir_check_call_status(); zephir_stripcslashes(&_6, &_7); zephir_fast_trim(return_value, &_6, NULL , ZEPHIR_TRIM_BOTH TSRMLS_CC); diff --git a/ext/test/trytest.zep.c b/ext/test/trytest.zep.c index 187f15f68c..d438bb6c13 100644 --- a/ext/test/trytest.zep.c +++ b/ext/test/trytest.zep.c @@ -192,7 +192,7 @@ PHP_METHOD(Test_TryTest, testTry4) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 90, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 98, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 48 TSRMLS_CC); goto try_end_1; @@ -262,7 +262,7 @@ PHP_METHOD(Test_TryTest, testTry5) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 90, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 98, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 65 TSRMLS_CC); goto try_end_1; @@ -331,7 +331,7 @@ PHP_METHOD(Test_TryTest, testTry6) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 90, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 98, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 82 TSRMLS_CC); goto try_end_1; @@ -399,7 +399,7 @@ PHP_METHOD(Test_TryTest, testTry7) { object_init_ex(&_2$$5, spl_ce_RuntimeException); ZEPHIR_INIT_VAR(&_3$$5); ZVAL_STRING(&_3$$5, "error!"); - ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 90, &_3$$5); + ZEPHIR_CALL_METHOD(NULL, &_2$$5, "__construct", NULL, 98, &_3$$5); zephir_check_call_status_or_jump(try_end_1); zephir_throw_exception_debug(&_2$$5, "test/trytest.zep", 101 TSRMLS_CC); goto try_end_1; @@ -495,7 +495,7 @@ PHP_METHOD(Test_TryTest, testTry9) { /* try_start_1: */ - ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod1", NULL, 91); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod1", NULL, 99); zephir_check_call_status_or_jump(try_end_1); RETURN_MM_STRING("not catched"); @@ -530,7 +530,7 @@ PHP_METHOD(Test_TryTest, testTry10) { /* try_start_1: */ - ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod2", NULL, 92); + ZEPHIR_CALL_METHOD(NULL, this_ptr, "somemethod2", NULL, 100); zephir_check_call_status_or_jump(try_end_1); RETURN_MM_STRING("not catched"); From 2224376a5cfb2161a4a2b7393f48be68724f73d7 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 23:42:07 +0300 Subject: [PATCH 30/38] Remove no longer used tests --- unit-tests/fixtures/lifecycle/expected2.c | 206 -------------- unit-tests/fixtures/typehints/expected2.c | 257 ------------------ .../fixtures/typehints/expected_args2.h | 21 -- .../fixtures/typehints/expected_both2.h | 15 - .../fixtures/typehints/expected_retval2.h | 63 ----- 5 files changed, 562 deletions(-) delete mode 100644 unit-tests/fixtures/lifecycle/expected2.c delete mode 100644 unit-tests/fixtures/typehints/expected2.c delete mode 100644 unit-tests/fixtures/typehints/expected_args2.h delete mode 100644 unit-tests/fixtures/typehints/expected_both2.h delete mode 100644 unit-tests/fixtures/typehints/expected_retval2.h diff --git a/unit-tests/fixtures/lifecycle/expected2.c b/unit-tests/fixtures/lifecycle/expected2.c deleted file mode 100644 index 252863d6d0..0000000000 --- a/unit-tests/fixtures/lifecycle/expected2.c +++ /dev/null @@ -1,206 +0,0 @@ - -/* This file was generated automatically by Zephir do not modify it! */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -// TODO: Deprecated. Will be removed in future -#if PHP_VERSION_ID < 50500 -#include -#endif - -#include "php_ext.h" -#include "lifecycle.h" - -#include - -#include -#include -#include - -#include "kernel/globals.h" -#include "kernel/main.h" -#include "kernel/fcall.h" -#include "kernel/memory.h" - - -#include "takedown_funcs.h" -#include "setup_funcs.h" -#include "prep_funcs.h" - -zend_class_entry *lifecycle_test_ce; - -ZEND_DECLARE_MODULE_GLOBALS(lifecycle) - -PHP_INI_BEGIN() - -PHP_INI_END() - -static PHP_MINIT_FUNCTION(lifecycle) -{ -// TODO: Deprecated. Will be removed in future -#if PHP_VERSION_ID < 50500 - char* old_lc_all = setlocale(LC_ALL, NULL); - if (old_lc_all) { - size_t len = strlen(old_lc_all); - char *tmp = calloc(len+1, 1); - if (UNEXPECTED(!tmp)) { - return FAILURE; - } - - memcpy(tmp, old_lc_all, len); - old_lc_all = tmp; - } - - setlocale(LC_ALL, "C"); -#endif - REGISTER_INI_ENTRIES(); - ZEPHIR_INIT(Lifecycle_Test); - ext_setup_module(); - ext_prep_module(); - -// TODO: Deprecated. Will be removed in future -#if PHP_VERSION_ID < 50500 - setlocale(LC_ALL, old_lc_all); - free(old_lc_all); -#endif - return SUCCESS; -} - -#ifndef ZEPHIR_RELEASE -static PHP_MSHUTDOWN_FUNCTION(lifecycle) -{ - ext_takedown_module(); - ext_kill_module(); - zephir_deinitialize_memory(TSRMLS_C); - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} -#endif - -/** - * Initialize globals on each request or each thread started - */ -static void php_zephir_init_globals(zend_lifecycle_globals *lifecycle_globals TSRMLS_DC) -{ - lifecycle_globals->initialized = 0; - - /* Memory options */ - lifecycle_globals->active_memory = NULL; - - /* Virtual Symbol Tables */ - lifecycle_globals->active_symbol_table = NULL; - - /* Cache Enabled */ - lifecycle_globals->cache_enabled = 1; - - /* Recursive Lock */ - lifecycle_globals->recursive_lock = 0; - - /* Static cache */ - memset(lifecycle_globals->scache, '\0', sizeof(zephir_fcall_cache_entry*) * ZEPHIR_MAX_CACHE_SLOTS); - - - ext_setup_globals(); -} - -/** - * Initialize globals only on each thread started - */ -static void php_zephir_init_module_globals(zend_lifecycle_globals *lifecycle_globals TSRMLS_DC) -{ - -} - -static PHP_RINIT_FUNCTION(lifecycle) -{ - zend_lifecycle_globals *lifecycle_globals_ptr = ZEPHIR_VGLOBAL; - - php_zephir_init_globals(lifecycle_globals_ptr TSRMLS_CC); - //zephir_init_interned_strings(TSRMLS_C); - zephir_initialize_memory(lifecycle_globals_ptr TSRMLS_CC); - - ext_setup_request(); - return SUCCESS; -} - -static PHP_RSHUTDOWN_FUNCTION(lifecycle) -{ - ext_takedown_request(); - zephir_deinitialize_memory(TSRMLS_C); - return SUCCESS; -} - -#define ZEPHIR_POST_REQUEST 1 -static PHP_PRSHUTDOWN_FUNCTION(lifecycle) -{ - ext_takedown_request(); -} - -static PHP_MINFO_FUNCTION(lifecycle) -{ - php_info_print_box_start(0); - php_printf("%s", PHP_LIFECYCLE_DESCRIPTION); - php_info_print_box_end(); - - php_info_print_table_start(); - php_info_print_table_header(2, PHP_LIFECYCLE_NAME, "enabled"); - php_info_print_table_row(2, "Author", PHP_LIFECYCLE_AUTHOR); - php_info_print_table_row(2, "Version", PHP_LIFECYCLE_VERSION); - php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ ); - php_info_print_table_row(2, "Powered by Zephir", "Version " PHP_LIFECYCLE_ZEPVERSION); - php_info_print_table_end(); - - DISPLAY_INI_ENTRIES(); -} - -static PHP_GINIT_FUNCTION(lifecycle) -{ - php_zephir_init_globals(lifecycle_globals TSRMLS_CC); - php_zephir_init_module_globals(lifecycle_globals TSRMLS_CC); -} - -static PHP_GSHUTDOWN_FUNCTION(lifecycle) -{ - ext_takedown_globals(); -} - - -zend_function_entry php_lifecycle_functions[] = { - ZEND_FE_END - -}; - -zend_module_entry lifecycle_module_entry = { - STANDARD_MODULE_HEADER_EX, - NULL, - NULL, - PHP_LIFECYCLE_EXTNAME, - php_lifecycle_functions, - PHP_MINIT(lifecycle), -#ifndef ZEPHIR_RELEASE - PHP_MSHUTDOWN(lifecycle), -#else - NULL, -#endif - PHP_RINIT(lifecycle), - PHP_RSHUTDOWN(lifecycle), - PHP_MINFO(lifecycle), - PHP_LIFECYCLE_VERSION, - ZEND_MODULE_GLOBALS(lifecycle), - PHP_GINIT(lifecycle), - PHP_GSHUTDOWN(lifecycle), -#ifdef ZEPHIR_POST_REQUEST - PHP_PRSHUTDOWN(lifecycle), -#else - NULL, -#endif - STANDARD_MODULE_PROPERTIES_EX -}; - -#ifdef COMPILE_DL_LIFECYCLE -ZEND_GET_MODULE(lifecycle) -#endif diff --git a/unit-tests/fixtures/typehints/expected2.c b/unit-tests/fixtures/typehints/expected2.c deleted file mode 100644 index 33313fbb26..0000000000 --- a/unit-tests/fixtures/typehints/expected2.c +++ /dev/null @@ -1,257 +0,0 @@ - -/* This file was generated automatically by Zephir do not modify it! */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include - -// TODO: Deprecated. Will be removed in future -#if PHP_VERSION_ID < 50500 -#include -#endif - -#include "php_ext.h" -#include "typehints.h" - -#include - -#include -#include -#include - -#include "kernel/globals.h" -#include "kernel/main.h" -#include "kernel/fcall.h" -#include "kernel/memory.h" - - - -zend_class_entry *typehints_args_ce; -zend_class_entry *typehints_both_ce; -zend_class_entry *typehints_retval_ce; - -ZEND_DECLARE_MODULE_GLOBALS(typehints) - -PHP_INI_BEGIN() - -PHP_INI_END() - -static PHP_MINIT_FUNCTION(typehints) -{ -// TODO: Deprecated. Will be removed in future -#if PHP_VERSION_ID < 50500 - char* old_lc_all = setlocale(LC_ALL, NULL); - if (old_lc_all) { - size_t len = strlen(old_lc_all); - char *tmp = calloc(len+1, 1); - if (UNEXPECTED(!tmp)) { - return FAILURE; - } - - memcpy(tmp, old_lc_all, len); - old_lc_all = tmp; - } - - setlocale(LC_ALL, "C"); -#endif - REGISTER_INI_ENTRIES(); - ZEPHIR_INIT(TypeHints_Args); - ZEPHIR_INIT(TypeHints_Both); - ZEPHIR_INIT(TypeHints_RetVal); - - -// TODO: Deprecated. Will be removed in future -#if PHP_VERSION_ID < 50500 - setlocale(LC_ALL, old_lc_all); - free(old_lc_all); -#endif - return SUCCESS; -} - -#ifndef ZEPHIR_RELEASE -static PHP_MSHUTDOWN_FUNCTION(typehints) -{ - - zephir_deinitialize_memory(TSRMLS_C); - UNREGISTER_INI_ENTRIES(); - return SUCCESS; -} -#endif - -/** - * Initialize globals on each request or each thread started - */ -static void php_zephir_init_globals(zend_typehints_globals *typehints_globals TSRMLS_DC) -{ - typehints_globals->initialized = 0; - - /* Memory options */ - typehints_globals->active_memory = NULL; - - /* Virtual Symbol Tables */ - typehints_globals->active_symbol_table = NULL; - - /* Cache Enabled */ - typehints_globals->cache_enabled = 1; - - /* Recursive Lock */ - typehints_globals->recursive_lock = 0; - - /* Static cache */ - memset(typehints_globals->scache, '\0', sizeof(zephir_fcall_cache_entry*) * ZEPHIR_MAX_CACHE_SLOTS); - - - -} - -/** - * Initialize globals only on each thread started - */ -static void php_zephir_init_module_globals(zend_typehints_globals *typehints_globals TSRMLS_DC) -{ - -} - -static PHP_RINIT_FUNCTION(typehints) -{ - zend_typehints_globals *typehints_globals_ptr = ZEPHIR_VGLOBAL; - - php_zephir_init_globals(typehints_globals_ptr TSRMLS_CC); - //zephir_init_interned_strings(TSRMLS_C); - zephir_initialize_memory(typehints_globals_ptr TSRMLS_CC); - - - return SUCCESS; -} - -static PHP_RSHUTDOWN_FUNCTION(typehints) -{ - - zephir_deinitialize_memory(TSRMLS_C); - return SUCCESS; -} - - - -static PHP_MINFO_FUNCTION(typehints) -{ - php_info_print_box_start(0); - php_printf("%s", PHP_TYPEHINTS_DESCRIPTION); - php_info_print_box_end(); - - php_info_print_table_start(); - php_info_print_table_header(2, PHP_TYPEHINTS_NAME, "enabled"); - php_info_print_table_row(2, "Author", PHP_TYPEHINTS_AUTHOR); - php_info_print_table_row(2, "Version", PHP_TYPEHINTS_VERSION); - php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__ ); - php_info_print_table_row(2, "Powered by Zephir", "Version " PHP_TYPEHINTS_ZEPVERSION); - php_info_print_table_end(); - - DISPLAY_INI_ENTRIES(); -} - -static PHP_GINIT_FUNCTION(typehints) -{ - php_zephir_init_globals(typehints_globals TSRMLS_CC); - php_zephir_init_module_globals(typehints_globals TSRMLS_CC); -} - -static PHP_GSHUTDOWN_FUNCTION(typehints) -{ - -} - -PHP_FUNCTION(f_TypeHints_args); -ZEND_BEGIN_ARG_INFO_EX(arginfo_f_typehints_args, 0, 0, 7) - ZEND_ARG_INFO(0, _var) - ZEND_ARG_INFO(0, _string) - ZEND_ARG_INFO(0, _bool) - ZEND_ARG_INFO(0, _int) - ZEND_ARG_INFO(0, _long) - ZEND_ARG_INFO(0, _double) - ZEND_ARG_OBJ_INFO(0, _args, TypeHints\\Args, 0) -ZEND_END_ARG_INFO() - -PHP_FUNCTION(f_TypeHints_both); -ZEND_BEGIN_ARG_INFO_EX(arginfo_f_typehints_both, 0, 0, 1) - ZEND_ARG_INFO(0, _string) -ZEND_END_ARG_INFO() - -PHP_FUNCTION(f_TypeHints_retval_var_var_builit_1); -PHP_FUNCTION(f_TypeHints_retval_var_var_builit_2); -PHP_FUNCTION(f_TypeHints_retval_var); -PHP_FUNCTION(f_TypeHints_retval_string); -PHP_FUNCTION(f_TypeHints_retval_boolean); -PHP_FUNCTION(f_TypeHints_retval_int); -PHP_FUNCTION(f_TypeHints_retval_long); -PHP_FUNCTION(f_TypeHints_retval_double); -PHP_FUNCTION(f_TypeHints_retval_retval); -PHP_FUNCTION(f_TypeHints_retval_nullable_int); -PHP_FUNCTION(f_TypeHints_retval_nullable_uint); -PHP_FUNCTION(f_TypeHints_retval_nullable_long); -PHP_FUNCTION(f_TypeHints_retval_nullable_float); -PHP_FUNCTION(f_TypeHints_retval_nullable_double); -PHP_FUNCTION(f_TypeHints_retval_nullable_string); -PHP_FUNCTION(f_TypeHints_retval_nullable_boolean); -PHP_FUNCTION(f_TypeHints_retval_nullable_char); -PHP_FUNCTION(f_TypeHints_retval_object_or_scalar); -PHP_FUNCTION(f_TypeHints_retval_array_of_objects); - -zend_function_entry php_typehints_functions[] = { - ZEND_NS_NAMED_FE("TypeHints", args, ZEND_FN(f_TypeHints_args), arginfo_f_typehints_args) -ZEND_NS_NAMED_FE("TypeHints", both, ZEND_FN(f_TypeHints_both), arginfo_f_typehints_both) -ZEND_NS_NAMED_FE("TypeHints", retval_var_var_builit_1, ZEND_FN(f_TypeHints_retval_var_var_builit_1), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_var_var_builit_2, ZEND_FN(f_TypeHints_retval_var_var_builit_2), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_var, ZEND_FN(f_TypeHints_retval_var), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_string, ZEND_FN(f_TypeHints_retval_string), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_boolean, ZEND_FN(f_TypeHints_retval_boolean), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_int, ZEND_FN(f_TypeHints_retval_int), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_long, ZEND_FN(f_TypeHints_retval_long), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_double, ZEND_FN(f_TypeHints_retval_double), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_retval, ZEND_FN(f_TypeHints_retval_retval), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_nullable_int, ZEND_FN(f_TypeHints_retval_nullable_int), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_nullable_uint, ZEND_FN(f_TypeHints_retval_nullable_uint), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_nullable_long, ZEND_FN(f_TypeHints_retval_nullable_long), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_nullable_float, ZEND_FN(f_TypeHints_retval_nullable_float), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_nullable_double, ZEND_FN(f_TypeHints_retval_nullable_double), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_nullable_string, ZEND_FN(f_TypeHints_retval_nullable_string), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_nullable_boolean, ZEND_FN(f_TypeHints_retval_nullable_boolean), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_nullable_char, ZEND_FN(f_TypeHints_retval_nullable_char), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_object_or_scalar, ZEND_FN(f_TypeHints_retval_object_or_scalar), NULL) -ZEND_NS_NAMED_FE("TypeHints", retval_array_of_objects, ZEND_FN(f_TypeHints_retval_array_of_objects), NULL) -ZEND_FE_END - -}; - -zend_module_entry typehints_module_entry = { - STANDARD_MODULE_HEADER_EX, - NULL, - NULL, - PHP_TYPEHINTS_EXTNAME, - php_typehints_functions, - PHP_MINIT(typehints), -#ifndef ZEPHIR_RELEASE - PHP_MSHUTDOWN(typehints), -#else - NULL, -#endif - PHP_RINIT(typehints), - PHP_RSHUTDOWN(typehints), - PHP_MINFO(typehints), - PHP_TYPEHINTS_VERSION, - ZEND_MODULE_GLOBALS(typehints), - PHP_GINIT(typehints), - PHP_GSHUTDOWN(typehints), -#ifdef ZEPHIR_POST_REQUEST - PHP_PRSHUTDOWN(typehints), -#else - NULL, -#endif - STANDARD_MODULE_PROPERTIES_EX -}; - -#ifdef COMPILE_DL_TYPEHINTS -ZEND_GET_MODULE(typehints) -#endif diff --git a/unit-tests/fixtures/typehints/expected_args2.h b/unit-tests/fixtures/typehints/expected_args2.h deleted file mode 100644 index e936c74ab6..0000000000 --- a/unit-tests/fixtures/typehints/expected_args2.h +++ /dev/null @@ -1,21 +0,0 @@ - -extern zend_class_entry *typehints_args_ce; - -ZEPHIR_INIT_CLASS(TypeHints_Args); - -PHP_METHOD(TypeHints_Args, args); - -ZEND_BEGIN_ARG_INFO_EX(arginfo_typehints_args_args, 0, 0, 7) - ZEND_ARG_INFO(0, _var) - ZEND_ARG_INFO(0, _string) - ZEND_ARG_INFO(0, _bool) - ZEND_ARG_INFO(0, _int) - ZEND_ARG_INFO(0, _long) - ZEND_ARG_INFO(0, _double) - ZEND_ARG_OBJ_INFO(0, _args, TypeHints\\Args, 0) -ZEND_END_ARG_INFO() - -ZEPHIR_INIT_FUNCS(typehints_args_method_entry) { - PHP_ME(TypeHints_Args, args, arginfo_typehints_args_args, ZEND_ACC_PUBLIC) - PHP_FE_END -}; diff --git a/unit-tests/fixtures/typehints/expected_both2.h b/unit-tests/fixtures/typehints/expected_both2.h deleted file mode 100644 index 8560db5523..0000000000 --- a/unit-tests/fixtures/typehints/expected_both2.h +++ /dev/null @@ -1,15 +0,0 @@ - -extern zend_class_entry *typehints_both_ce; - -ZEPHIR_INIT_CLASS(TypeHints_Both); - -PHP_METHOD(TypeHints_Both, both); - -ZEND_BEGIN_ARG_INFO_EX(arginfo_typehints_both_both, 0, 0, 1) - ZEND_ARG_INFO(0, _string) -ZEND_END_ARG_INFO() - -ZEPHIR_INIT_FUNCS(typehints_both_method_entry) { - PHP_ME(TypeHints_Both, both, arginfo_typehints_both_both, ZEND_ACC_PUBLIC) - PHP_FE_END -}; diff --git a/unit-tests/fixtures/typehints/expected_retval2.h b/unit-tests/fixtures/typehints/expected_retval2.h deleted file mode 100644 index 57283beeeb..0000000000 --- a/unit-tests/fixtures/typehints/expected_retval2.h +++ /dev/null @@ -1,63 +0,0 @@ - -extern zend_class_entry *typehints_retval_ce; - -ZEPHIR_INIT_CLASS(TypeHints_RetVal); - -PHP_METHOD(TypeHints_RetVal, getMyVar); -PHP_METHOD(TypeHints_RetVal, getMyString); -PHP_METHOD(TypeHints_RetVal, getMyArray); -PHP_METHOD(TypeHints_RetVal, retval_var_var); -PHP_METHOD(TypeHints_RetVal, retval_var_var_builit_1); -PHP_METHOD(TypeHints_RetVal, retval_var_var_builit_2); -PHP_METHOD(TypeHints_RetVal, retval_var); -PHP_METHOD(TypeHints_RetVal, retval_string); -PHP_METHOD(TypeHints_RetVal, retval_boolean); -PHP_METHOD(TypeHints_RetVal, retval_int); -PHP_METHOD(TypeHints_RetVal, retval_long); -PHP_METHOD(TypeHints_RetVal, retval_double); -PHP_METHOD(TypeHints_RetVal, retval_array); -PHP_METHOD(TypeHints_RetVal, retval_array_of_objects); -PHP_METHOD(TypeHints_RetVal, retval_collection); -PHP_METHOD(TypeHints_RetVal, retval_retval); -PHP_METHOD(TypeHints_RetVal, retval_nullable_int); -PHP_METHOD(TypeHints_RetVal, retval_nullable_uint); -PHP_METHOD(TypeHints_RetVal, retval_nullable_long); -PHP_METHOD(TypeHints_RetVal, retval_nullable_float); -PHP_METHOD(TypeHints_RetVal, retval_nullable_double); -PHP_METHOD(TypeHints_RetVal, retval_nullable_string); -PHP_METHOD(TypeHints_RetVal, retval_nullable_boolean); -PHP_METHOD(TypeHints_RetVal, retval_nullable_char); -PHP_METHOD(TypeHints_RetVal, retval_nullable_array); -PHP_METHOD(TypeHints_RetVal, retval_object_or_scalar); -PHP_METHOD(TypeHints_RetVal, retval_static_object_or_scalar); - -ZEPHIR_INIT_FUNCS(typehints_retval_method_entry) { - PHP_ME(TypeHints_RetVal, getMyVar, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, getMyString, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, getMyArray, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_var_var, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_var_var_builit_1, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_var_var_builit_2, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_var, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_string, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_boolean, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_int, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_long, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_double, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_array, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_array_of_objects, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_collection, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_retval, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_nullable_int, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_nullable_uint, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_nullable_long, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_nullable_float, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_nullable_double, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_nullable_string, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_nullable_boolean, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_nullable_char, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_nullable_array, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_object_or_scalar, NULL, ZEND_ACC_PUBLIC) - PHP_ME(TypeHints_RetVal, retval_static_object_or_scalar, NULL, ZEND_ACC_PUBLIC|ZEND_ACC_STATIC) - PHP_FE_END -}; From 2e7acbda94d9e025f7f9fadefc1f52f9c7d0b0ea Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Sun, 4 Aug 2019 23:54:07 +0300 Subject: [PATCH 31/38] Correct test fixtures --- CHANGELOG.md | 19 ++++--------------- unit-tests/fixtures/lifecycle/.editorconfig | 4 ++++ unit-tests/fixtures/lifecycle/expected3.c | 7 ++++++- unit-tests/fixtures/typehints/.editorconfig | 3 --- unit-tests/fixtures/typehints/expected3.c | 7 ++++++- 5 files changed, 20 insertions(+), 20 deletions(-) create mode 100644 unit-tests/fixtures/lifecycle/.editorconfig diff --git a/CHANGELOG.md b/CHANGELOG.md index 9fe649a312..a3447589ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,24 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] ### Added -- Introduced initial ability to generate `zend_module_deps` by using - `requires` from project configuration (`config.json`) +- Introduced initial ability to generate `zend_module_deps` + [#1900](https://github.com/phalcon/zephir/pull/1900), [phalcon/cphalcon#13702](https://github.com/phalcon/cphalcon/issues/13702), - [phalcon/cphalcon#13794](https://github.com/phalcon/cphalcon/pull/13794). - To do so, add to your `config.json` configuration like this: - ``` - "requires": { - "extensions": [ - "module1", - "module2", - "module3" - ] - } - ``` - + [phalcon/cphalcon#13794](https://github.com/phalcon/cphalcon/pull/13794) ### Changed -- Write errors to stderr if available +- Write errors compiler to stderr if available ## [0.12.1] - 2019-07-30 ### Added diff --git a/unit-tests/fixtures/lifecycle/.editorconfig b/unit-tests/fixtures/lifecycle/.editorconfig new file mode 100644 index 0000000000..059d88d4f2 --- /dev/null +++ b/unit-tests/fixtures/lifecycle/.editorconfig @@ -0,0 +1,4 @@ +# EditorConfig is awesome: http://EditorConfig.org + +[*.{c,h}] +trim_trailing_whitespace = false diff --git a/unit-tests/fixtures/lifecycle/expected3.c b/unit-tests/fixtures/lifecycle/expected3.c index 4e960654b9..596fd0ce56 100644 --- a/unit-tests/fixtures/lifecycle/expected3.c +++ b/unit-tests/fixtures/lifecycle/expected3.c @@ -145,10 +145,15 @@ zend_function_entry php_lifecycle_functions[] = { }; +static const zend_module_dep php_lifecycle_deps[] = { + + ZEND_MOD_END +}; + zend_module_entry lifecycle_module_entry = { STANDARD_MODULE_HEADER_EX, NULL, - NULL, + php_lifecycle_deps, PHP_LIFECYCLE_EXTNAME, php_lifecycle_functions, PHP_MINIT(lifecycle), diff --git a/unit-tests/fixtures/typehints/.editorconfig b/unit-tests/fixtures/typehints/.editorconfig index e29dd1f55d..059d88d4f2 100644 --- a/unit-tests/fixtures/typehints/.editorconfig +++ b/unit-tests/fixtures/typehints/.editorconfig @@ -1,7 +1,4 @@ # EditorConfig is awesome: http://EditorConfig.org -root = false - [*.{c,h}] trim_trailing_whitespace = false -indent_style = tab diff --git a/unit-tests/fixtures/typehints/expected3.c b/unit-tests/fixtures/typehints/expected3.c index e1241be5fb..8f6254520e 100644 --- a/unit-tests/fixtures/typehints/expected3.c +++ b/unit-tests/fixtures/typehints/expected3.c @@ -329,10 +329,15 @@ ZEND_FE_END }; +static const zend_module_dep php_typehints_deps[] = { + + ZEND_MOD_END +}; + zend_module_entry typehints_module_entry = { STANDARD_MODULE_HEADER_EX, NULL, - NULL, + php_typehints_deps, PHP_TYPEHINTS_EXTNAME, php_typehints_functions, PHP_MINIT(typehints), From 5545e24c1c76b32533cf980f305914763dd9448e Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 5 Aug 2019 00:12:09 +0300 Subject: [PATCH 32/38] Added test for #1900 --- Library/Config.php | 2 +- unit-tests/fixtures/deps/config.json | 14 ++++++++++++++ unit-tests/fixtures/deps/deps/test.zep | 5 +++++ unit-tests/fixtures/genfailure2 | 1 + unit-tests/sharness/Makefile | 2 +- unit-tests/sharness/t0004-generate-errors.sh | 10 ++++++++-- 6 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 unit-tests/fixtures/deps/config.json create mode 100644 unit-tests/fixtures/deps/deps/test.zep create mode 100644 unit-tests/fixtures/genfailure2 diff --git a/Library/Config.php b/Library/Config.php index 0e71f7119c..1d5fe9a99d 100644 --- a/Library/Config.php +++ b/Library/Config.php @@ -91,7 +91,7 @@ class Config implements \ArrayAccess, \JsonSerializable 'namespace' => '', 'name' => '', 'description' => '', - 'author' => '', + 'author' => 'Zephir Team', 'version' => '0.0.1', 'verbose' => false, 'requires' => [ diff --git a/unit-tests/fixtures/deps/config.json b/unit-tests/fixtures/deps/config.json new file mode 100644 index 0000000000..0bf29c2f3e --- /dev/null +++ b/unit-tests/fixtures/deps/config.json @@ -0,0 +1,14 @@ +{ + "namespace": "deps", + "name": "deps", + "version": "0.0.1", + "verbose": false, + + "requires": { + "extensions": [ + "foo", + "bar", + "baz" + ] + } +} diff --git a/unit-tests/fixtures/deps/deps/test.zep b/unit-tests/fixtures/deps/deps/test.zep new file mode 100644 index 0000000000..7345f36a33 --- /dev/null +++ b/unit-tests/fixtures/deps/deps/test.zep @@ -0,0 +1,5 @@ +namespace Deps; + +class Test +{ +} diff --git a/unit-tests/fixtures/genfailure2 b/unit-tests/fixtures/genfailure2 new file mode 100644 index 0000000000..de097ac7e9 --- /dev/null +++ b/unit-tests/fixtures/genfailure2 @@ -0,0 +1 @@ +Could not load extension(s): foo, bar, baz. You must load extensions above before build this extension. diff --git a/unit-tests/sharness/Makefile b/unit-tests/sharness/Makefile index 061c8af58d..0c50a92eb5 100644 --- a/unit-tests/sharness/Makefile +++ b/unit-tests/sharness/Makefile @@ -26,7 +26,7 @@ clean: clean-test-results find $(TESTSDIR)/fixtures -name compile-errors.log -o -name compile.log -delete find $(TESTSDIR)/fixtures -name .zephir -type d -exec rm -rf {} + find $(TESTSDIR)/fixtures -name ext -type d -exec rm -rf {} + - find $(TESTSDIR)/output -type d -path $(TESTSDIR)/output -prune -o -exec rm -rf {} + + find $(TESTSDIR)/output/* -type d -exec rm -rf {} + find $(TESTSDIR)/output -type f -not -name .gitignore -delete -rm -rf "trash "directory.* diff --git a/unit-tests/sharness/t0004-generate-errors.sh b/unit-tests/sharness/t0004-generate-errors.sh index a203ca38ee..52c7dace12 100755 --- a/unit-tests/sharness/t0004-generate-errors.sh +++ b/unit-tests/sharness/t0004-generate-errors.sh @@ -9,8 +9,14 @@ test_expect_success "Should fail when Zephir files to compile couldn't be found" cd $OUTPUTDIR && zephirc init genfailure1 && cd genfailure1 && - test_expect_code 1 zephirc generate --no-ansi 2>actual && - test_cmp $FIXTURESDIR/genfailure1 actual + test_expect_code 1 zephirc generate --no-ansi 2>$OUTPUTDIR/actual && + test_cmp $FIXTURESDIR/genfailure1 $OUTPUTDIR/actual +" + +test_expect_success "Should fail when there are no required modules" " + cd $FIXTURESDIR/deps && + test_expect_code 1 zephirc generate --no-ansi 2>$OUTPUTDIR/actual && + test_cmp $FIXTURESDIR/genfailure2 $OUTPUTDIR/actual " test_done From f5c5a6602f4c2055a77b62611414ed1defb3074b Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 5 Aug 2019 00:43:17 +0300 Subject: [PATCH 33/38] Avoid using external script to build extension --- .travis.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index d371591904..86082eca7b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -99,11 +99,14 @@ install: fi before_script: - - .ci/build-test-ext.sh + - zephir clean 2>&1 || exit 1 + - zephir fullclean 2>&1 || exit 1 + - zephir generate 2>&1 || exit 1 + - zephir stubs 2>&1 || exit 1 + - zephir api 2>&1 || exit 1 - cat .ci/travis.ini >> "$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/travis.ini" script: - - zephir - .ci/run-tests.sh - (cd unit-tests/sharness && PHP=$(phpenv which php) make) From 5d0953eb3756c51afb6ef6f0d4eb41c9cce986bd Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 5 Aug 2019 00:50:02 +0300 Subject: [PATCH 34/38] Avoid using external script to build extension (2) --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 86082eca7b..79e81855b4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -104,6 +104,7 @@ before_script: - zephir generate 2>&1 || exit 1 - zephir stubs 2>&1 || exit 1 - zephir api 2>&1 || exit 1 + - zephir compile 2>&1 || exit 1 - cat .ci/travis.ini >> "$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/travis.ini" script: From 2b3d5be1c347bc1ba384a954f84076d01f6c9cac Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 5 Aug 2019 01:12:53 +0300 Subject: [PATCH 35/38] Cleaned build-test-ext.sh [skip appveyor] --- .ci/build-test-ext.sh | 22 ++++++---------------- .travis.yml | 7 +------ 2 files changed, 7 insertions(+), 22 deletions(-) diff --git a/.ci/build-test-ext.sh b/.ci/build-test-ext.sh index 7a4a11ef62..59639d4148 100755 --- a/.ci/build-test-ext.sh +++ b/.ci/build-test-ext.sh @@ -40,21 +40,6 @@ phpize if [ "$REPORT_COVERAGE" -eq 1 ] then - # The ltmain.sh which bundled with PHP it's from libtool 1.5.26. - # However, the version of libtool that claims to no longer remove - # ".gcno" profiler information is libtool 2.2.6. The fix is probably - # in later libtool versions as well. - if [ "$(uname -s 2>/dev/null)" = "Darwin" ] - then - # macOS - libtoolize_bin=$(command -v glibtoolize 2>/dev/null) - else - # Linux, Gentoo, etc - libtoolize_bin=$(command -v libtoolize 2>/dev/null) - fi - - aclocal && ${libtoolize_bin} --copy --force && autoheader && autoconf - CFLAGS=${CFLAGS//-O[0-9s]/} CXXFLAGS=${CXXFLAGS//-O[0-9s]/} LDFLAGS=${LDFLAGS//--coverage/} @@ -72,5 +57,10 @@ else fi make -j"$(getconf _NPROCESSORS_ONLN)" 2> ./compile-errors.log +exitcode=$? + +test "$exitcode" = 0 || { + test -f ./compile-errors.log && cat ./compile-errors.log +} -exit $? +exit $exitcode diff --git a/.travis.yml b/.travis.yml index 79e81855b4..18d0150b06 100644 --- a/.travis.yml +++ b/.travis.yml @@ -99,12 +99,7 @@ install: fi before_script: - - zephir clean 2>&1 || exit 1 - - zephir fullclean 2>&1 || exit 1 - - zephir generate 2>&1 || exit 1 - - zephir stubs 2>&1 || exit 1 - - zephir api 2>&1 || exit 1 - - zephir compile 2>&1 || exit 1 + - .ci/build-test-ext.sh - cat .ci/travis.ini >> "$(phpenv root)/versions/$(phpenv version-name)/etc/conf.d/travis.ini" script: From 85472af155bc39272443a3b70d8994c8a5a97188 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 5 Aug 2019 01:25:30 +0300 Subject: [PATCH 36/38] Added initial codecov settings [skip appveyor] --- .codecov.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .codecov.yml diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000000..a3694f70e8 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,14 @@ +codecov: + notify: + require_ci_to_pass: yes + +comment: + layout: "header, diff" + behavior: default + require_changes: no + +ignore: + # ignore folders and all its contents + - "/home/travis/.phpenv/.*" + - "php-zephir-parser/.*" + - ".phpunit/.*" From 69fea031d0c377fbc62d720e4d17c52c11920bc2 Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 5 Aug 2019 09:01:20 +0300 Subject: [PATCH 37/38] Amended codecov config [skip appveyor] --- .codecov.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/.codecov.yml b/.codecov.yml index a3694f70e8..17f04fa14e 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -2,13 +2,39 @@ codecov: notify: require_ci_to_pass: yes +coverage: + precision: 2 + round: down + range: "33...90" + + status: + project: + default: + # Allow the coverage to drop by threshold %, and posting a success status. + threshold: 0.5 + patch: + default: + # trial operation + target: 0% + changes: no + comment: layout: "header, diff" behavior: default require_changes: no ignore: + - ".git" + - "*.yml" + - "*.json" + - "*.md" # ignore folders and all its contents + - ".ci/.*" + - ".github/.*" + - ".zephir/.*" + - "ide/.*" - "/home/travis/.phpenv/.*" - "php-zephir-parser/.*" - ".phpunit/.*" + - "tests/.*" + - "vendor/.*" From b3f17c25f3a1dd679dd595dbed9692984703700d Mon Sep 17 00:00:00 2001 From: Serghei Iakovlev Date: Mon, 5 Aug 2019 21:02:14 +0300 Subject: [PATCH 38/38] Update change log --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3447589ae..8fff14dc2f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] + +## [0.12.2] - 2019-08-05 ### Added - Introduced initial ability to generate `zend_module_deps` [#1900](https://github.com/phalcon/zephir/pull/1900), @@ -208,7 +210,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Fixed casting resource to int (only ZendEngine 3) [#1524](https://github.com/phalcon/zephir/issues/1524) -[Unreleased]: https://github.com/phalcon/zephir/compare/0.12.1...HEAD +[Unreleased]: https://github.com/phalcon/zephir/compare/0.12.2...HEAD +[0.12.2]: https://github.com/phalcon/zephir/compare/0.12.1...0.12.2 [0.12.1]: https://github.com/phalcon/zephir/compare/0.12.0...0.12.1 [0.12.0]: https://github.com/phalcon/zephir/compare/0.11.12...0.12.0 [0.11.12]: https://github.com/phalcon/zephir/compare/0.11.11...0.11.12