diff --git a/.github/actions/brew/action.yml b/.github/actions/brew/action.yml index 51d37aa56d470..567929d0306dc 100644 --- a/.github/actions/brew/action.yml +++ b/.github/actions/brew/action.yml @@ -31,6 +31,7 @@ runs: tidy-html5 \ libxml2 \ libjpeg \ + libsodium \ libxslt \ postgresql brew link icu4c gettext --force diff --git a/.github/actions/configure-macos/action.yml b/.github/actions/configure-macos/action.yml index 317d705645985..cda8e7fbac8f4 100644 --- a/.github/actions/configure-macos/action.yml +++ b/.github/actions/configure-macos/action.yml @@ -9,15 +9,16 @@ runs: - shell: bash run: | set -x - export PATH="/usr/local/opt/bison/bin:$PATH" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/openssl@1.1/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/curl/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/krb5/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libffi/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libxml2/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/libxslt/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/zlib/lib/pkgconfig" - export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/opt/icu4c/lib/pkgconfig" + BREW_OPT="$(brew --prefix)"/opt + export PATH="$BREW_OPT/bison/bin:$PATH" + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/openssl@1.1/lib/pkgconfig" + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/curl/lib/pkgconfig" + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/krb5/lib/pkgconfig" + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/libffi/lib/pkgconfig" + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/libxml2/lib/pkgconfig" + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/libxslt/lib/pkgconfig" + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/zlib/lib/pkgconfig" + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:$BREW_OPT/icu4c/lib/pkgconfig" ./buildconf --force ./configure \ --enable-option-checking=fatal \ @@ -25,8 +26,8 @@ runs: --enable-fpm \ --with-pdo-mysql=mysqlnd \ --with-mysqli=mysqlnd \ - --with-pgsql=/usr/local/opt/libpq \ - --with-pdo-pgsql=/usr/local/opt/libpq \ + --with-pgsql="$BREW_OPT"/libpq \ + --with-pdo-pgsql="$BREW_OPT"/libpq \ --with-pdo-sqlite \ --without-pear \ --enable-gd \ @@ -39,25 +40,24 @@ runs: --enable-soap \ --enable-xmlreader \ --with-xsl \ - --with-tidy=/usr/local/opt/tidy-html5 \ + --with-tidy="$BREW_OPT"/tidy-html5 \ --with-libxml \ --enable-sysvsem \ --enable-sysvshm \ --enable-shmop \ --enable-pcntl \ - --with-readline=/usr/local/opt/readline \ + --with-readline="$BREW_OPT"/readline \ --enable-mbstring \ --with-curl \ - --with-gettext=/usr/local/opt/gettext \ + --with-gettext="$BREW_OPT"/gettext \ --enable-sockets \ - --with-bz2=/usr/local/opt/bzip2 \ + --with-bz2="$BREW_OPT"/bzip2 \ --with-openssl \ - --with-gmp=/usr/local/opt/gmp \ - --with-iconv=/usr/local/opt/libiconv \ + --with-gmp="$BREW_OPT"/gmp \ + --with-iconv="$BREW_OPT"/libiconv \ --enable-bcmath \ --enable-calendar \ --enable-ftp \ - --with-pspell=/usr/local/opt/aspell \ --with-kerberos \ --enable-sysvmsg \ --with-ffi \ diff --git a/.github/actions/verify-generated-files/action.yml b/.github/actions/verify-generated-files/action.yml index 139dd84662411..d4ca6301144c0 100644 --- a/.github/actions/verify-generated-files/action.yml +++ b/.github/actions/verify-generated-files/action.yml @@ -5,7 +5,7 @@ runs: - shell: bash run: | set -x - [[ "$OSTYPE" == "darwin"* ]] && export PATH="/usr/local/opt/bison/bin:$PATH" + [[ "$OSTYPE" == "darwin"* ]] && export PATH="$(brew --prefix)/opt/bison/bin:$PATH" scripts/dev/credits scripts/dev/genfiles Zend/zend_vm_gen.php diff --git a/.github/nightly_matrix.php b/.github/nightly_matrix.php index e74508785e219..597528b940607 100644 --- a/.github/nightly_matrix.php +++ b/.github/nightly_matrix.php @@ -1,23 +1,16 @@ 'master', 'ref' => 'master', 'version' => ['major' => 8, 'minor' => 4]], + ['name' => 'PHP-8.3', 'ref' => 'PHP-8.3', 'version' => ['major' => 8, 'minor' => 3]], + ['name' => 'PHP-8.2', 'ref' => 'PHP-8.2', 'version' => ['major' => 8, 'minor' => 2]], + ['name' => 'PHP-8.1', 'ref' => 'PHP-8.1', 'version' => ['major' => 8, 'minor' => 1]], +]; function get_branch_commit_cache_file_path(): string { return dirname(__DIR__) . '/branch-commit-cache.json'; } -function get_branch_matrix(array $branches) { - $result = array_map(function ($branch) { - $branch_key = strtoupper(str_replace('.', '', $branch)); - return [ - 'name' => $branch_key, - 'ref' => $branch, - ]; - }, $branches); - - return $result; -} - function get_branches() { $branch_commit_cache_file = get_branch_commit_cache_file_path(); $branch_commit_map = []; @@ -27,19 +20,19 @@ function get_branches() { $changed_branches = []; foreach (BRANCHES as $branch) { - $previous_commit_hash = $branch_commit_map[$branch] ?? null; - $current_commit_hash = trim(shell_exec('git rev-parse origin/' . $branch)); + $previous_commit_hash = $branch_commit_map[$branch['ref']] ?? null; + $current_commit_hash = trim(shell_exec('git rev-parse origin/' . $branch['ref'])); if ($previous_commit_hash !== $current_commit_hash) { $changed_branches[] = $branch; } - $branch_commit_map[$branch] = $current_commit_hash; + $branch_commit_map[$branch['ref']] = $current_commit_hash; } file_put_contents($branch_commit_cache_file, json_encode($branch_commit_map)); - return get_branch_matrix($changed_branches); + return $changed_branches; } function get_matrix_include(array $branches) { @@ -53,27 +46,28 @@ function get_matrix_include(array $branches) { 'configuration_parameters' => "CFLAGS='-fsanitize=undefined,address -DZEND_TRACK_ARENA_ALLOC' LDFLAGS='-fsanitize=undefined,address'", 'run_tests_parameters' => '--asan', 'test_function_jit' => false, + 'asan' => true, + ]; + $jobs[] = [ + 'name' => '_REPEAT', + 'branch' => $branch, + 'debug' => true, + 'zts' => false, + 'run_tests_parameters' => '--repeat 2', + 'timeout_minutes' => 360, + 'test_function_jit' => true, + 'asan' => false, + ]; + $jobs[] = [ + 'name' => '_VARIATION', + 'branch' => $branch, + 'debug' => true, + 'zts' => true, + 'configuration_parameters' => "CFLAGS='-DZEND_RC_DEBUG=1 -DPROFITABILITY_CHECKS=0 -DZEND_VERIFY_FUNC_INFO=1 -DZEND_VERIFY_TYPE_INFERENCE'", + 'timeout_minutes' => 360, + 'test_function_jit' => true, + 'asan' => false, ]; - if ($branch['ref'] !== 'PHP-8.0') { - $jobs[] = [ - 'name' => '_REPEAT', - 'branch' => $branch, - 'debug' => true, - 'zts' => false, - 'run_tests_parameters' => '--repeat 2', - 'timeout_minutes' => 360, - 'test_function_jit' => true, - ]; - $jobs[] = [ - 'name' => '_VARIATION', - 'branch' => $branch, - 'debug' => true, - 'zts' => true, - 'configuration_parameters' => "CFLAGS='-DZEND_RC_DEBUG=1 -DPROFITABILITY_CHECKS=0 -DZEND_VERIFY_FUNC_INFO=1'", - 'timeout_minutes' => 360, - 'test_function_jit' => true, - ]; - } } return $jobs; } @@ -97,17 +91,61 @@ function get_windows_matrix_include(array $branches) { return $jobs; } +function get_macos_matrix_include(array $branches) { + $jobs = []; + foreach ($branches as $branch) { + foreach([true, false] as $debug) { + foreach([true, false] as $zts) { + $jobs[] = [ + 'branch' => $branch, + 'debug' => $debug, + 'zts' => $zts, + 'os' => $branch === 'master' ? '13' : '12', + 'arch' => 'X64', + ]; + if ($branch['version']['minor'] >= 4 || $branch['version']['major'] >= 9) { + $jobs[] = [ + 'branch' => $branch, + 'debug' => $debug, + 'zts' => $zts, + 'os' => '14', + 'arch' => 'ARM64', + ]; + } + } + } + } + return $jobs; +} + +function get_current_version(): array { + $file = dirname(__DIR__) . '/main/php_version.h'; + $content = file_get_contents($file); + preg_match('(^#define PHP_MAJOR_VERSION (?\d+)$)m', $content, $matches); + $major = $matches['num']; + preg_match('(^#define PHP_MINOR_VERSION (?\d+)$)m', $content, $matches); + $minor = $matches['num']; + return ['major' => $major, 'minor' => $minor]; +} + $trigger = $argv[1] ?? 'schedule'; $attempt = (int) ($argv[2] ?? 1); $discard_cache = ($trigger === 'schedule' && $attempt !== 1) || $trigger === 'workflow_dispatch'; if ($discard_cache) { @unlink(get_branch_commit_cache_file_path()); } +$branch = $argv[3] ?? 'master'; -$branches = get_branches(); +$branches = $branch === 'master' + ? get_branches() + : [['name' => strtoupper($branch), 'ref' => $branch, 'version' => get_current_version()]]; $matrix_include = get_matrix_include($branches); $windows_matrix_include = get_windows_matrix_include($branches); +$macos_matrix_include = get_macos_matrix_include($branches); -echo '::set-output name=branches::' . json_encode($branches, JSON_UNESCAPED_SLASHES) . "\n"; -echo '::set-output name=matrix-include::' . json_encode($matrix_include, JSON_UNESCAPED_SLASHES) . "\n"; -echo '::set-output name=windows-matrix-include::' . json_encode($windows_matrix_include, JSON_UNESCAPED_SLASHES) . "\n"; +$f = fopen(getenv('GITHUB_OUTPUT'), 'a'); +fwrite($f, 'branches=' . json_encode($branches, JSON_UNESCAPED_SLASHES) . "\n"); +fwrite($f, 'matrix-include=' . json_encode($matrix_include, JSON_UNESCAPED_SLASHES) . "\n"); +fwrite($f, 'windows-matrix-include=' . json_encode($windows_matrix_include, JSON_UNESCAPED_SLASHES) . "\n"); +fwrite($f, 'macos-matrix-include=' . json_encode($macos_matrix_include, JSON_UNESCAPED_SLASHES) . "\n"); +fclose($f); diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index a8fdd0a867bec..e55f5d9bb16f0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -3,6 +3,8 @@ on: schedule: - cron: "0 1 * * *" workflow_dispatch: ~ +permissions: + contents: read jobs: GENERATE_MATRIX: name: Generate Matrix @@ -12,6 +14,7 @@ jobs: branches: ${{ steps.set-matrix.outputs.branches }} matrix-include: ${{ steps.set-matrix.outputs.matrix-include }} windows-matrix-include: ${{ steps.set-matrix.outputs.windows-matrix-include }} + macos-matrix-include: ${{ steps.set-matrix.outputs.macos-matrix-include }} steps: - uses: actions/checkout@v4 with: @@ -30,7 +33,7 @@ jobs: nightly- - name: Generate Matrix id: set-matrix - run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" + run: php .github/nightly_matrix.php "${{ github.event_name }}" "${{ github.run_attempt }}" "${{ github.head_ref || github.ref_name }}" - name: Notify Slack if: failure() uses: ./.github/actions/notify-slack @@ -39,6 +42,22 @@ jobs: LINUX_X64: needs: GENERATE_MATRIX if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} + services: + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: test + firebird: + image: jacobalberty/firebird + ports: + - 3050:3050 + env: + ISC_PASSWORD: test + FIREBIRD_DATABASE: test.fdb + FIREBIRD_USER: test + FIREBIRD_PASSWORD: test strategy: fail-fast: false matrix: @@ -51,7 +70,7 @@ jobs: zts: [true, false] include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.matrix-include) }} name: "${{ matrix.branch.name }}_LINUX_X64${{ matrix.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - runs-on: ubuntu-20.04 + runs-on: ubuntu-${{ (matrix.branch.version.minor >= 3 && !matrix.asan) && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -63,6 +82,14 @@ jobs: uses: ./.github/actions/setup-oracle - name: apt uses: ./.github/actions/apt-x64 + - name: System info + run: | + echo "::group::Show host CPU info" + lscpu + echo "::endgroup::" + echo "::group::Show installed package versions" + dpkg -l + echo "::endgroup::" - name: ./configure uses: ./.github/actions/configure-x64 with: @@ -131,11 +158,7 @@ jobs: name: "${{ matrix.branch.name }}_LINUX_X32_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" runs-on: ubuntu-latest container: - image: ubuntu:20.04 - env: - MYSQL_TEST_HOST: mysql - PDO_MYSQL_TEST_DSN: mysql:host=mysql;dbname=test - PDO_MYSQL_TEST_HOST: mysql + image: ubuntu:${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} services: mysql: image: mysql:8 @@ -151,6 +174,14 @@ jobs: ref: ${{ matrix.branch.ref }} - name: apt uses: ./.github/actions/apt-x32 + - name: System info + run: | + echo "::group::Show host CPU info" + lscpu + echo "::endgroup::" + echo "::group::Show installed package versions" + dpkg -l + echo "::endgroup::" - name: ./configure uses: ./.github/actions/configure-x32 with: @@ -200,11 +231,9 @@ jobs: strategy: fail-fast: false matrix: - branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} - debug: [true, false] - zts: [true, false] - name: "${{ matrix.branch.name }}_MACOS_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" - runs-on: macos-12 + include: ${{ fromJson(needs.GENERATE_MATRIX.outputs.macos-matrix-include) }} + name: "${{ matrix.branch.name }}_MACOS_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" + runs-on: macos-${{ matrix.os }} steps: - name: git checkout uses: actions/checkout@v4 @@ -220,40 +249,37 @@ jobs: --${{ matrix.zts && 'enable' || 'disable' }}-zts - name: make run: |- - export PATH="/usr/local/opt/bison/bin:$PATH" + export PATH="$(brew --prefix)/opt/bison/bin:$PATH" make -j$(sysctl -n hw.logicalcpu) >/dev/null - name: make install run: sudo make install - name: Test uses: ./.github/actions/test-macos with: - testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} + testArtifacts: ${{ matrix.branch.name }}_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} - name: Test Tracing JIT uses: ./.github/actions/test-macos with: - testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT + testArtifacts: ${{ matrix.branch.name }}_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT jitType: tracing runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 - name: Test OpCache uses: ./.github/actions/test-macos with: - testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} OpCache + testArtifacts: ${{ matrix.branch.name }}_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} OpCache runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 - name: Test Function JIT uses: ./.github/actions/test-macos with: - testArtifacts: ${{ matrix.branch.name }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Function JIT + testArtifacts: ${{ matrix.branch.name }}_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Function JIT jitType: function runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files - name: Notify Slack @@ -263,14 +289,28 @@ jobs: token: ${{ secrets.ACTION_MONITORING_SLACK }} COVERAGE_DEBUG_NTS: if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch' - runs-on: ubuntu-20.04 + services: + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: test + firebird: + image: jacobalberty/firebird + ports: + - 3050:3050 + env: + ISC_PASSWORD: test + FIREBIRD_DATABASE: test.fdb + FIREBIRD_USER: test + FIREBIRD_PASSWORD: test + runs-on: ubuntu-22.04 steps: - name: git checkout uses: actions/checkout@v4 - name: Create MSSQL container uses: ./.github/actions/setup-mssql - - name: Create Oracle container - uses: ./.github/actions/setup-oracle - name: apt uses: ./.github/actions/apt-x64 - name: Install gcovr @@ -289,6 +329,7 @@ jobs: - name: Test OpCache uses: ./.github/actions/test-linux with: + jitType: tracing runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 @@ -307,9 +348,16 @@ jobs: fail-fast: false matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} - name: "${{ matrix.branch.name }}_COMMUNITY" - runs-on: ubuntu-20.04 + type: ['asan', 'verify_type_inference'] + # These branches don't include type verification + exclude: + - { branch: { name: 'PHP-8.1', ref: 'PHP-8.1', major: 8, minor: 1 }, type: 'verify_type_inference' } + - { branch: { name: 'PHP-8.2', ref: 'PHP-8.2', major: 8, minor: 2 }, type: 'verify_type_inference' } + - { branch: { name: 'PHP-8.3', ref: 'PHP-8.3', major: 8, minor: 3 }, type: 'verify_type_inference' } + name: "${{ matrix.branch.name }}_COMMUNITY_${{ matrix.type }}" + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} env: + ASAN_OPTIONS: exitcode=139 UBSAN_OPTIONS: print_stacktrace=1 USE_ZEND_ALLOC: 0 USE_TRACKED_ALLOC: 1 @@ -323,11 +371,11 @@ jobs: - name: ./configure uses: ./.github/actions/configure-x64 with: + # CFLAGS removes O2, so we have to add it again... configurationParameters: >- - --enable-debug --enable-zts - CFLAGS='-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC' - LDFLAGS='-fsanitize=undefined,address' + ${{ matrix.type == 'asan' && '--enable-debug CFLAGS="-fsanitize=undefined,address -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address"' || '' }} + ${{ matrix.type == 'verify_type_inference' && 'CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE -O2"' || '' }} - name: make run: make -j$(/usr/bin/nproc) >/dev/null - name: make install @@ -337,14 +385,48 @@ jobs: sudo service mysql start mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test" mysql -uroot -proot -e "SET GLOBAL local_infile = true" - - name: Enable Opcache and JIT + - name: Enable Opcache run: | + echo memory_limit=-1 >> /etc/php.d/opcache.ini echo zend_extension=opcache.so > /etc/php.d/opcache.ini echo opcache.enable_cli=1 >> /etc/php.d/opcache.ini + echo opcache.enable=1 >> /etc/php.d/opcache.ini echo opcache.protect_memory=1 >> /etc/php.d/opcache.ini + echo opcache.memory_consumption=256M >> /etc/php.d/opcache.ini + echo opcache.file_update_protection=0 >> /etc/php.d/opcache.ini + echo opcache.interned_strings_buffer=64 >> /etc/php.d/opcache.ini + echo opcache.max_accelerated_files=100000 >> /etc/php.d/opcache.ini + - name: Enable JIT + if: matrix.type != 'verify_type_inference' + run: | + echo opcache.jit=tracing >> /etc/php.d/opcache.ini echo opcache.jit_buffer_size=1G >> /etc/php.d/opcache.ini + echo opcache.jit_max_root_traces=100000 >> /etc/php.d/opcache.ini + echo opcache.jit_max_side_traces=100000 >> /etc/php.d/opcache.ini + echo opcache.jit_max_exit_counters=100000 >> /etc/php.d/opcache.ini + echo opcache.jit_hot_loop=1 >> /etc/php.d/opcache.ini + echo opcache.jit_hot_func=1 >> /etc/php.d/opcache.ini + echo opcache.jit_hot_return=1 >> /etc/php.d/opcache.ini + echo opcache.jit_hot_side_exit=1 >> /etc/php.d/opcache.ini + php -v + - name: Test AMPHP + run: | + repositories="amp cache dns file http parallel parser pipeline process serialization socket sync websocket-client websocket-server" + X=0 + for repository in $repositories; do + printf "Testing amp/%s\n" "$repository" + git clone "https://github.com/amphp/$repository.git" "amphp-$repository" --depth 1 + cd "amphp-$repository" + git rev-parse HEAD + php /usr/bin/composer install --no-progress --ignore-platform-reqs + vendor/bin/phpunit || EXIT_CODE=$? + if [ ${EXIT_CODE:-0} -gt 128 ]; then + X=1; + fi + cd .. + done + exit $X - name: Test Laravel - if: matrix.branch.ref != 'PHP-8.0' run: | git clone https://github.com/laravel/framework.git --branch=master --depth=1 cd framework @@ -352,13 +434,38 @@ jobs: php /usr/bin/composer install --no-progress --ignore-platform-reqs # Hack to disable a test that hangs php -r '$c = file_get_contents("tests/Filesystem/FilesystemTest.php"); $c = str_replace("public function testSharedGet()", "#[\\PHPUnit\\Framework\\Attributes\\Group('"'"'skip'"'"')]\n public function testSharedGet()", $c); file_put_contents("tests/Filesystem/FilesystemTest.php", $c);' - export ASAN_OPTIONS=exitcode=139 php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$? - if [ $EXIT_CODE -gt 128 ]; then + if [ ${EXIT_CODE:-0} -gt 128 ]; then + exit 1 + fi + - name: Test ReactPHP + run: | + repositories="async cache child-process datagram dns event-loop promise promise-stream promise-timer stream" + X=0 + for repository in $repositories; do + printf "Testing reactphp/%s\n" "$repository" + git clone "https://github.com/reactphp/$repository.git" "reactphp-$repository" --depth 1 + cd "reactphp-$repository" + git rev-parse HEAD + php /usr/bin/composer install --no-progress --ignore-platform-reqs + vendor/bin/phpunit || EXIT_CODE=$? + if [ $[EXIT_CODE:-0} -gt 128 ]; then + X=1; + fi + cd .. + done + exit $X + - name: Test Revolt PHP + run: | + git clone https://github.com/revoltphp/event-loop.git --depth=1 + cd event-loop + git rev-parse HEAD + php /usr/bin/composer install --no-progress --ignore-platform-reqs + vendor/bin/phpunit || EXIT_CODE=$? + if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi - name: Test Symfony - if: matrix.branch.ref != 'PHP-8.0' run: | git clone https://github.com/symfony/symfony.git --depth=1 cd symfony @@ -369,12 +476,11 @@ jobs: php -r '$c = file_get_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php"); $c = str_replace("public function testSanitizeDeepNestedString()", "/** @group skip */\n public function testSanitizeDeepNestedString()", $c); file_put_contents("src/Symfony/Component/HtmlSanitizer/Tests/HtmlSanitizerCustomTest.php", $c);' # Buggy FFI test in Symfony, see https://github.com/symfony/symfony/issues/47668 php -r '$c = file_get_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php"); $c = str_replace("*/\n public function testCastNonTrailingCharPointer()", "* @group skip\n */\n public function testCastNonTrailingCharPointer()", $c); file_put_contents("src/Symfony/Component/VarDumper/Tests/Caster/FFICasterTest.php", $c);' - export ASAN_OPTIONS=exitcode=139 export SYMFONY_DEPRECATIONS_HELPER=max[total]=999 X=0 for component in $(find src/Symfony -mindepth 2 -type f -name phpunit.xml.dist -printf '%h\n'); do php ./phpunit $component --exclude-group tty,benchmark,intl-data,transient --exclude-group skip || EXIT_CODE=$? - if [ $EXIT_CODE -gt 128 ]; then + if [ ${EXIT_CODE:-0} -gt 128 ]; then X=1; fi done @@ -385,14 +491,12 @@ jobs: git clone https://github.com/sebastianbergmann/phpunit.git --branch=main --depth=1 cd phpunit git rev-parse HEAD - export ASAN_OPTIONS=exitcode=139 php /usr/bin/composer install --no-progress --ignore-platform-reqs php ./phpunit || EXIT_CODE=$? - if [ $EXIT_CODE -gt 128 ]; then + if [ ${EXIT_CODE:-0} -gt 128 ]; then exit 1 fi - name: 'Symfony Preloading' - if: matrix.branch.ref != 'PHP-8.0' run: | php /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress --ignore-platform-reqs cd symfony_demo @@ -405,7 +509,6 @@ jobs: git clone https://github.com/WordPress/wordpress-develop.git wordpress --depth=1 cd wordpress git rev-parse HEAD - export ASAN_OPTIONS=exitcode=139 php /usr/bin/composer install --no-progress --ignore-platform-reqs cp wp-tests-config-sample.php wp-tests-config.php sed -i 's/youremptytestdbnamehere/test/g' wp-tests-config.php @@ -423,12 +526,28 @@ jobs: OPCACHE_VARIATION: needs: GENERATE_MATRIX if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} + services: + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: test + firebird: + image: jacobalberty/firebird + ports: + - 3050:3050 + env: + ISC_PASSWORD: test + FIREBIRD_DATABASE: test.fdb + FIREBIRD_USER: test + FIREBIRD_PASSWORD: test strategy: fail-fast: false matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} name: "${{ matrix.branch.name }}_OPCACHE_VARIATION" - runs-on: ubuntu-20.04 + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -504,7 +623,7 @@ jobs: matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} name: "${{ matrix.branch.name }}_MSAN" - runs-on: ubuntu-22.04 + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -556,7 +675,8 @@ jobs: --enable-werror \ --enable-memory-sanitizer \ --with-config-file-path=/etc \ - --with-config-file-scan-dir=/etc/php.d + --with-config-file-scan-dir=/etc/php.d \ + --enable-dl-test=shared - name: make run: make -j$(/usr/bin/nproc) >/dev/null - name: make install @@ -600,10 +720,8 @@ jobs: fail-fast: false matrix: branch: ${{ fromJson(needs.GENERATE_MATRIX.outputs.branches) }} - exclude: - - branch: { name: 'PHP-80', ref: 'PHP-8.0' } name: "${{ matrix.branch.name }}_LIBMYSQLCLIENT" - runs-on: ubuntu-20.04 + runs-on: ubuntu-${{ matrix.branch.version.minor >= 3 && '22.04' || '20.04' }} steps: - name: git checkout uses: actions/checkout@v4 @@ -619,30 +737,23 @@ jobs: mysql -uroot -proot -e "CREATE DATABASE IF NOT EXISTS test" # Ensure local_infile tests can run. mysql -uroot -proot -e "SET GLOBAL local_infile = true" - # Does not support caching_sha2_auth :( - # - name: Build mysql-5.6 - # uses: ./.github/actions/build-libmysqlclient - # with: - # libmysql: mysql-5.6.49-linux-glibc2.12-x86_64.tar.gz - # - name: Test mysql-5.6 - # uses: ./.github/actions/test-libmysqlclient - - name: Build mysql-5.7 + - name: Build mysql-8.0 uses: ./.github/actions/build-libmysqlclient with: - libmysql: mysql-5.7.44-linux-glibc2.12-x86_64.tar.gz + configurationParameters: --enable-werror + libmysql: mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }} - - name: Test mysql-5.7 + - name: Test mysql-8.0 uses: ./.github/actions/test-libmysqlclient with: withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }} - - name: Build mysql-8.0 + - name: Build mysql-8.2 uses: ./.github/actions/build-libmysqlclient with: - # FIXME: There are new warnings - # configurationParameters: --enable-werror - libmysql: mysql-8.0.33-linux-glibc2.12-x86_64.tar.xz + configurationParameters: --enable-werror + libmysql: mysql-8.2.0-linux-glibc2.28-x86_64.tar.xz withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }} - - name: Test mysql-8.0 + - name: Test mysql-8.2 uses: ./.github/actions/test-libmysqlclient with: withMysqli: ${{ matrix.branch.ref == 'PHP-8.1' }} @@ -653,6 +764,118 @@ jobs: uses: ./.github/actions/notify-slack with: token: ${{ secrets.ACTION_MONITORING_SLACK }} + PECL: + if: github.repository_owner == 'php' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-22.04 + env: + CC: ccache gcc + CXX: ccache g++ + steps: + - name: git checkout PHP + uses: actions/checkout@v4 + with: + path: php + - name: git checkout apcu + uses: actions/checkout@v4 + with: + repository: krakjoe/apcu + path: apcu + - name: git checkout imagick + uses: actions/checkout@v4 + with: + repository: Imagick/imagick + path: imagick + - name: git checkout memcached + uses: actions/checkout@v4 + with: + repository: php-memcached-dev/php-memcached + path: memcached + - name: git checkout redis + # Currently fails to build + if: false + uses: actions/checkout@v4 + with: + repository: phpredis/phpredis + path: redis + - name: git checkout xdebug + uses: actions/checkout@v4 + with: + repository: xdebug/xdebug + path: xdebug + - name: git checkout yaml + uses: actions/checkout@v4 + with: + repository: php/pecl-file_formats-yaml + path: yaml + - name: apt + run: | + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ + ccache \ + libmemcached-dev \ + bison \ + re2c + - name: ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: "${{github.job}}-${{hashFiles('php/main/php_version.h')}}" + append-timestamp: false + - name: build PHP + run: | + cd php + ./buildconf --force + ./configure \ + --enable-option-checking=fatal \ + --prefix=/opt/php \ + --enable-cli \ + --disable-all \ + --enable-session \ + --enable-werror + make -j$(/usr/bin/nproc) + sudo make install + - name: build apcu + run: | + cd apcu + /opt/php/bin/phpize + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: build imagick + run: | + cd imagick + /opt/php/bin/phpize + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: build memcached + run: | + cd memcached + /opt/php/bin/phpize + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: build redis + # Currently fails to build + if: false + run: | + cd redis + /opt/php/bin/phpize + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: build xdebug + run: | + cd xdebug + /opt/php/bin/phpize + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: build yaml + run: | + cd yaml + /opt/php/bin/phpize + ./configure --prefix=/opt/php --with-php-config=/opt/php/bin/php-config + make -j$(/usr/bin/nproc) + - name: Notify Slack + if: failure() + uses: ./.github/actions/notify-slack + with: + token: ${{ secrets.ACTION_MONITORING_SLACK }} WINDOWS: needs: GENERATE_MATRIX if: ${{ needs.GENERATE_MATRIX.outputs.branches != '[]' }} @@ -666,7 +889,7 @@ jobs: PHP_BUILD_CACHE_BASE_DIR: C:\build-cache PHP_BUILD_OBJ_DIR: C:\obj PHP_BUILD_CACHE_SDK_DIR: C:\build-cache\sdk - PHP_BUILD_SDK_BRANCH: php-sdk-2.2.0 + PHP_BUILD_SDK_BRANCH: php_downloads_server_migration_v1 PHP_BUILD_CRT: vs16 PLATFORM: ${{ matrix.x64 && 'x64' || 'x86' }} THREAD_SAFE: "${{ matrix.zts && '1' || '0' }}" diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 96e721749f834..c59fbb3196d8c 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -98,7 +98,28 @@ jobs: - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files MACOS_DEBUG_NTS: - runs-on: macos-12 + strategy: + fail-fast: false + matrix: + include: + - os: 12 + arch: X64 + debug: true + zts: false + - os: 12 + arch: X64 + debug: false + zts: true + - os: 14 + arch: ARM64 + debug: true + zts: false + - os: 14 + arch: ARM64 + debug: false + zts: true + name: "MACOS_${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }}" + runs-on: macos-${{ matrix.os }} steps: - name: git checkout uses: actions/checkout@v4 @@ -107,27 +128,28 @@ jobs: - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: - key: "${{github.job}}-${{hashFiles('main/php_version.h')}}" + key: "${{github.job}}-${{ matrix.arch }}_${{matrix.os}}-${{ matrix.debug && 'DEBUG' || 'RELEASE' }}-${{ matrix.zts && 'ZTS' || 'NTS' }}-${{hashFiles('main/php_version.h')}}" append-timestamp: false - name: ./configure uses: ./.github/actions/configure-macos with: - configurationParameters: --enable-debug --disable-zts + configurationParameters: >- + --${{ matrix.debug && 'enable' || 'disable' }}-debug + --${{ matrix.zts && 'enable' || 'disable' }}-zts - name: make run: |- - export PATH="/usr/local/opt/bison/bin:$PATH" + export PATH="$(brew --prefix bison)/bin:$PATH" make -j$(sysctl -n hw.logicalcpu) >/dev/null - name: make install run: sudo make install - name: Test Tracing JIT uses: ./.github/actions/test-macos with: - testArtifacts: ${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT + testArtifacts: ${{ matrix.arch }}_${{ matrix.debug && 'DEBUG' || 'RELEASE' }}_${{ matrix.zts && 'ZTS' || 'NTS' }} Tracing JIT jitType: tracing runTestsParameters: >- -d zend_extension=opcache.so -d opcache.enable_cli=1 - -d opcache.protect_memory=1 - name: Verify generated files are up to date uses: ./.github/actions/verify-generated-files WINDOWS: diff --git a/.gitignore b/.gitignore index b8eb03412fa61..49acc9f2e1788 100644 --- a/.gitignore +++ b/.gitignore @@ -169,6 +169,7 @@ php # Miscellaneous extensions files /ext/opcache/jit/zend_jit_x86.c +/ext/opcache/jit/zend_jit_arm64.c /ext/opcache/minilua # Generated by `cd ext/name && phpize && ./configure` diff --git a/Zend/Optimizer/zend_ssa.h b/Zend/Optimizer/zend_ssa.h index 9fde352c79cc1..28fbad1ab1232 100644 --- a/Zend/Optimizer/zend_ssa.h +++ b/Zend/Optimizer/zend_ssa.h @@ -67,8 +67,8 @@ struct _zend_ssa_phi { int var; /* Original CV, VAR or TMP variable index */ int ssa_var; /* SSA variable index */ int block; /* current BB index */ - int visited : 1; /* flag to avoid recursive processing */ - int has_range_constraint : 1; + unsigned int visited : 1; /* flag to avoid recursive processing */ + unsigned int has_range_constraint : 1; zend_ssa_phi **use_chains; zend_ssa_phi *sym_use_chain; int *sources; /* Array of SSA IDs that produce this var. diff --git a/ext/bcmath/libbcmath/src/add.c b/ext/bcmath/libbcmath/src/add.c index e92fb0502f014..15bf233200715 100644 --- a/ext/bcmath/libbcmath/src/add.c +++ b/ext/bcmath/libbcmath/src/add.c @@ -43,9 +43,7 @@ is the minimum scale for the result. */ void -bc_add (n1, n2, result, scale_min) - bc_num n1, n2, *result; - int scale_min; +bc_add (bc_num n1, bc_num n2, bc_num *result, int scale_min) { bc_num sum = NULL; int cmp_res; diff --git a/ext/bcmath/libbcmath/src/compare.c b/ext/bcmath/libbcmath/src/compare.c index f7c4a403993e7..07cd1f9d7a2f0 100644 --- a/ext/bcmath/libbcmath/src/compare.c +++ b/ext/bcmath/libbcmath/src/compare.c @@ -43,10 +43,7 @@ compare the magnitudes. */ int -_bc_do_compare (n1, n2, use_sign, ignore_last) - bc_num n1, n2; - int use_sign; - int ignore_last; +_bc_do_compare (bc_num n1, bc_num n2, int use_sign, int ignore_last) { char *n1ptr, *n2ptr; int count; @@ -152,8 +149,7 @@ _bc_do_compare (n1, n2, use_sign, ignore_last) /* This is the "user callable" routine to compare numbers N1 and N2. */ int -bc_compare (n1, n2) - bc_num n1, n2; +bc_compare (bc_num n1, bc_num n2) { return _bc_do_compare (n1, n2, TRUE, FALSE); } diff --git a/ext/bcmath/libbcmath/src/doaddsub.c b/ext/bcmath/libbcmath/src/doaddsub.c index fcd768f2929f8..72f64b410a7fd 100644 --- a/ext/bcmath/libbcmath/src/doaddsub.c +++ b/ext/bcmath/libbcmath/src/doaddsub.c @@ -43,9 +43,7 @@ SCALE_MIN is to set the minimum scale of the result. */ bc_num -_bc_do_add (n1, n2, scale_min) - bc_num n1, n2; - int scale_min; +_bc_do_add (bc_num n1, bc_num n2, int scale_min) { bc_num sum; int sum_scale, sum_digits; @@ -135,9 +133,7 @@ _bc_do_add (n1, n2, scale_min) of the result. */ bc_num -_bc_do_sub (n1, n2, scale_min) - bc_num n1, n2; - int scale_min; +_bc_do_sub (bc_num n1, bc_num n2, int scale_min) { bc_num diff; int diff_scale, diff_len; diff --git a/ext/bcmath/libbcmath/src/init.c b/ext/bcmath/libbcmath/src/init.c index 96e934b34da76..4e6edf6cde585 100644 --- a/ext/bcmath/libbcmath/src/init.c +++ b/ext/bcmath/libbcmath/src/init.c @@ -40,8 +40,7 @@ /* new_num allocates a number and sets fields to known values. */ bc_num -_bc_new_num_ex (length, scale, persistent) - int length, scale, persistent; +_bc_new_num_ex (int length, int scale, int persistent) { bc_num temp; /* PHP Change: malloc() -> pemalloc(), removed free_list code */ @@ -62,9 +61,7 @@ _bc_new_num_ex (length, scale, persistent) frees the storage if reference count is zero. */ void -_bc_free_num_ex (num, persistent) - bc_num *num; - int persistent; +_bc_free_num_ex (bc_num *num, int persistent) { if (*num == NULL) return; (*num)->n_refs--; diff --git a/ext/bcmath/libbcmath/src/int2num.c b/ext/bcmath/libbcmath/src/int2num.c index 3e675b627a8c4..3b27464e003cd 100644 --- a/ext/bcmath/libbcmath/src/int2num.c +++ b/ext/bcmath/libbcmath/src/int2num.c @@ -41,9 +41,7 @@ /* Convert an integer VAL to a bc number NUM. */ void -bc_int2num (num, val) - bc_num *num; - int val; +bc_int2num (bc_num *num, int val) { char buffer[30]; char *bptr, *vptr; diff --git a/ext/bcmath/libbcmath/src/nearzero.c b/ext/bcmath/libbcmath/src/nearzero.c index 0986b02b7a9ce..c94b3ba672a58 100644 --- a/ext/bcmath/libbcmath/src/nearzero.c +++ b/ext/bcmath/libbcmath/src/nearzero.c @@ -42,9 +42,7 @@ Last digit is defined by scale. */ char -bc_is_near_zero (num, scale) - bc_num num; - int scale; +bc_is_near_zero (bc_num num, int scale) { int count; char *nptr; diff --git a/ext/bcmath/libbcmath/src/neg.c b/ext/bcmath/libbcmath/src/neg.c index fe6f95aa34c85..8695d4e623f61 100644 --- a/ext/bcmath/libbcmath/src/neg.c +++ b/ext/bcmath/libbcmath/src/neg.c @@ -40,8 +40,7 @@ /* In some places we need to check if the number is negative. */ char -bc_is_neg (num) - bc_num num; +bc_is_neg (bc_num num) { return num->n_sign == MINUS; } diff --git a/ext/bcmath/libbcmath/src/num2long.c b/ext/bcmath/libbcmath/src/num2long.c index e40a126c72cb6..6628e16157ed6 100644 --- a/ext/bcmath/libbcmath/src/num2long.c +++ b/ext/bcmath/libbcmath/src/num2long.c @@ -43,8 +43,7 @@ the NUM for zero after having a zero returned. */ long -bc_num2long (num) - bc_num num; +bc_num2long (bc_num num) { long val; char *nptr; diff --git a/ext/bcmath/libbcmath/src/num2str.c b/ext/bcmath/libbcmath/src/num2str.c index 39f7adb1f0c39..c88ad902d7596 100644 --- a/ext/bcmath/libbcmath/src/num2str.c +++ b/ext/bcmath/libbcmath/src/num2str.c @@ -40,9 +40,7 @@ /* Convert a numbers to a string. Base 10 only.*/ zend_string -*bc_num2str_ex (num, scale) - bc_num num; - int scale; +*bc_num2str_ex (bc_num num, int scale) { zend_string *str; char *sptr; diff --git a/ext/bcmath/libbcmath/src/rmzero.c b/ext/bcmath/libbcmath/src/rmzero.c index 5e295c90af4d2..91d8e0fda9415 100644 --- a/ext/bcmath/libbcmath/src/rmzero.c +++ b/ext/bcmath/libbcmath/src/rmzero.c @@ -42,8 +42,7 @@ correct place and adjusts the length. */ void -_bc_rm_leading_zeros (num) - bc_num num; +_bc_rm_leading_zeros (bc_num num) { /* We can move n_value to point to the first non zero digit! */ while (*num->n_value == 0 && num->n_len > 1) { diff --git a/ext/bcmath/libbcmath/src/sub.c b/ext/bcmath/libbcmath/src/sub.c index 2949c71fbb664..4cc8cd80776cf 100644 --- a/ext/bcmath/libbcmath/src/sub.c +++ b/ext/bcmath/libbcmath/src/sub.c @@ -43,9 +43,7 @@ is the minimum scale for the result. */ void -bc_sub (n1, n2, result, scale_min) - bc_num n1, n2, *result; - int scale_min; +bc_sub (bc_num n1, bc_num n2, bc_num *result, int scale_min) { bc_num diff = NULL; int cmp_res; diff --git a/ext/dba/libcdb/cdb.c b/ext/dba/libcdb/cdb.c index 10cc4f9852156..0de105336cdef 100644 --- a/ext/dba/libcdb/cdb.c +++ b/ext/dba/libcdb/cdb.c @@ -185,7 +185,7 @@ int cdb_find(struct cdb *c, char *key, unsigned int len) /* }}} */ /* {{{ cdb_version */ -char *cdb_version() +char *cdb_version(void) { return "0.75, $Id$"; } diff --git a/ext/dba/libcdb/cdb_make.c b/ext/dba/libcdb/cdb_make.c index 8144ef10fb5d9..b4135dc4d803e 100644 --- a/ext/dba/libcdb/cdb_make.c +++ b/ext/dba/libcdb/cdb_make.c @@ -236,7 +236,7 @@ int cdb_make_finish(struct cdb_make *c) /* }}} */ /* {{{ cdb_make_version */ -char *cdb_make_version() +char *cdb_make_version(void) { return "0.75, $Id$"; } diff --git a/ext/dba/libflatfile/flatfile.c b/ext/dba/libflatfile/flatfile.c index a713373046dce..18368ec42cab3 100644 --- a/ext/dba/libflatfile/flatfile.c +++ b/ext/dba/libflatfile/flatfile.c @@ -276,7 +276,7 @@ datum flatfile_nextkey(flatfile *dba) { /* }}} */ /* {{{ flatfile_version */ -char *flatfile_version() +char *flatfile_version(void) { return "1.0, $Id$"; } diff --git a/ext/dba/libinifile/inifile.c b/ext/dba/libinifile/inifile.c index cdbd83769bd7c..0c001e5c57225 100644 --- a/ext/dba/libinifile/inifile.c +++ b/ext/dba/libinifile/inifile.c @@ -38,7 +38,7 @@ */ /* {{{ inifile_version */ -char *inifile_version() +char *inifile_version(void) { return "1.0, $Id$"; } diff --git a/ext/exif/exif.c b/ext/exif/exif.c index bf5fed01db52f..acf9e554b355d 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -3798,14 +3798,14 @@ static void exif_process_APP12(image_info_type *ImageInfo, char *buffer, size_t * Parse the marker stream until SOS or EOI is seen; */ static bool exif_scan_JPEG_header(image_info_type *ImageInfo) { - int section, sn; + int sn; int marker = 0, last_marker = M_PSEUDO, comment_correction=1; unsigned int ll, lh; uchar *Data; size_t fpos, size, got, itemlen; jpeg_sof_info sof_info; - for(section=0;;section++) { + while(1) { #ifdef EXIF_DEBUG fpos = php_stream_tell(ImageInfo->infile); exif_error_docref(NULL EXIFERR_CC, ImageInfo, E_NOTICE, "Needing section %d @ 0x%08X", ImageInfo->file.count, fpos); diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 509a5e4760626..e6f390bc24172 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -4068,7 +4068,7 @@ static gdIOCtx *create_stream_context(php_stream *stream, int close_stream) { return ctx; } -static gdIOCtx *create_output_context() { +static gdIOCtx *create_output_context(void) { gdIOCtx *ctx = ecalloc(1, sizeof(gdIOCtx)); ctx->putC = _php_image_output_putc; diff --git a/ext/gd/libgd/gd_jpeg.c b/ext/gd/libgd/gd_jpeg.c index f0974c2a99d48..7e006478aeb05 100644 --- a/ext/gd/libgd/gd_jpeg.c +++ b/ext/gd/libgd/gd_jpeg.c @@ -106,7 +106,7 @@ static void fatal_jpeg_error (j_common_ptr cinfo) exit (99); } -const char * gdJpegGetVersionString() +const char * gdJpegGetVersionString(void) { switch(JPEG_LIB_VERSION) { case 62: diff --git a/ext/gd/libgd/gd_png.c b/ext/gd/libgd/gd_png.c index 655eee77b9063..d15c02fa703de 100644 --- a/ext/gd/libgd/gd_png.c +++ b/ext/gd/libgd/gd_png.c @@ -37,7 +37,7 @@ ---------------------------------------------------------------------------*/ -const char * gdPngGetVersionString() +const char * gdPngGetVersionString(void) { return PNG_LIBPNG_VER_STRING; } diff --git a/ext/gd/libgd/gdft.c b/ext/gd/libgd/gdft.c index 6876ca6f6b428..ad9adad75392c 100644 --- a/ext/gd/libgd/gdft.c +++ b/ext/gd/libgd/gdft.c @@ -771,7 +771,7 @@ gdroundupdown (FT_F26Dot6 v1, int roundup) return (!roundup) ? v1 >> 6 : (v1 + 63) >> 6; } -void gdFontCacheShutdown() +void gdFontCacheShutdown(void) { gdMutexLock(gdFontCacheMutex); @@ -789,12 +789,12 @@ void gdFreeFontCache(void) gdFontCacheShutdown(); } -void gdFontCacheMutexSetup() +void gdFontCacheMutexSetup(void) { gdMutexSetup(gdFontCacheMutex); } -void gdFontCacheMutexShutdown() +void gdFontCacheMutexShutdown(void) { gdMutexShutdown(gdFontCacheMutex); } diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index 5aa25b57f01a2..c842e945a16e6 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -3988,8 +3988,8 @@ PHP_FUNCTION(mb_send_mail) char *to_r = NULL; char *force_extra_parameters = INI_STR("mail.force_extra_parameters"); struct { - int cnt_type:1; - int cnt_trans_enc:1; + unsigned int cnt_type:1; + unsigned int cnt_trans_enc:1; } suppressed_hdrs = { 0, 0 }; char *message_buf = NULL, *subject_buf = NULL, *p; diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c index bb8a130c41f65..da5dfbfa8b43e 100644 --- a/ext/mysqli/mysqli_nonapi.c +++ b/ext/mysqli/mysqli_nonapi.c @@ -678,7 +678,6 @@ static int mysqlnd_zval_array_from_mysqlnd_array(MYSQLND **in_array, zval *out_a MYSQLND **p = in_array; zval dest_array; zval *elem, *dest_elem; - int ret = 0; array_init_size(&dest_array, zend_hash_num_elements(Z_ARRVAL_P(out_array))); @@ -701,7 +700,6 @@ static int mysqlnd_zval_array_from_mysqlnd_array(MYSQLND **in_array, zval *out_a if (dest_elem) { zval_add_ref(dest_elem); } - ret++; p++; } } @@ -720,7 +718,6 @@ static int mysqlnd_dont_poll_zval_array_from_mysqlnd_array(MYSQLND **in_array, z { MYSQLND **p = in_array; zval proxy, *elem, *dest_elem; - int ret = 0; array_init(&proxy); if (in_array) { @@ -733,7 +730,6 @@ static int mysqlnd_dont_poll_zval_array_from_mysqlnd_array(MYSQLND **in_array, z if (dest_elem) { zval_add_ref(dest_elem); } - ret++; p++; } } ZEND_HASH_FOREACH_END(); diff --git a/ext/mysqlnd/mysqlnd_ps.c b/ext/mysqlnd/mysqlnd_ps.c index c564fca3097e5..d0932c571e5c6 100644 --- a/ext/mysqlnd/mysqlnd_ps.c +++ b/ext/mysqlnd/mysqlnd_ps.c @@ -1981,7 +1981,7 @@ MYSQLND_CLASS_METHODS_END; /* {{{ _mysqlnd_init_ps_subsystem */ -void _mysqlnd_init_ps_subsystem() +void _mysqlnd_init_ps_subsystem(void) { mysqlnd_stmt_set_methods(&MYSQLND_CLASS_METHOD_TABLE_NAME(mysqlnd_stmt)); _mysqlnd_init_ps_fetch_subsystem(); diff --git a/ext/mysqlnd/mysqlnd_ps_codec.c b/ext/mysqlnd/mysqlnd_ps_codec.c index 3b38d86273b68..89d90cc78c2a1 100644 --- a/ext/mysqlnd/mysqlnd_ps_codec.c +++ b/ext/mysqlnd/mysqlnd_ps_codec.c @@ -355,7 +355,7 @@ ps_fetch_bit(zval * zv, const MYSQLND_FIELD * const field, const unsigned int pa /* {{{ _mysqlnd_init_ps_fetch_subsystem */ -void _mysqlnd_init_ps_fetch_subsystem() +void _mysqlnd_init_ps_fetch_subsystem(void) { memset(mysqlnd_ps_fetch_functions, 0, sizeof(mysqlnd_ps_fetch_functions)); mysqlnd_ps_fetch_functions[MYSQL_TYPE_NULL].func = ps_fetch_null; diff --git a/ext/opcache/jit/zend_jit.c b/ext/opcache/jit/zend_jit.c index c4f169f811643..0cbb4f9d1ac8f 100644 --- a/ext/opcache/jit/zend_jit.c +++ b/ext/opcache/jit/zend_jit.c @@ -4629,12 +4629,7 @@ ZEND_EXT_API void zend_jit_unprotect(void) #ifdef HAVE_MPROTECT if (!(JIT_G(debug) & (ZEND_JIT_DEBUG_GDB|ZEND_JIT_DEBUG_PERF_DUMP))) { int opts = PROT_READ | PROT_WRITE; -#ifdef ZTS -#ifdef HAVE_PTHREAD_JIT_WRITE_PROTECT_NP - if (zend_write_protect) { - pthread_jit_write_protect_np(0); - } -#endif +#if defined(ZTS) && (!defined(__APPLE__) || !defined(__aarch64__)) opts |= PROT_EXEC; #endif if (mprotect(dasm_buf, dasm_size, opts) != 0) { diff --git a/ext/opcache/shared_alloc_mmap.c b/ext/opcache/shared_alloc_mmap.c index 33727d0da656c..6f01f1d631b74 100644 --- a/ext/opcache/shared_alloc_mmap.c +++ b/ext/opcache/shared_alloc_mmap.c @@ -180,9 +180,6 @@ static int create_segments(size_t requested_size, zend_shared_segment ***shared_ #ifdef PROT_MAX flags |= PROT_MAX(PROT_READ | PROT_WRITE | PROT_EXEC); #endif -#ifdef MAP_JIT - flags |= MAP_JIT; -#endif #if (defined(__linux__) || defined(__FreeBSD__)) && (defined(__x86_64__) || defined (__aarch64__)) && !defined(__SANITIZE_ADDRESS__) void *hint = find_prefered_mmap_base(requested_size); if (hint != MAP_FAILED) { diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index f6ed67b805b67..1bf6ebc622696 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -453,7 +453,7 @@ static int X509_get_signature_nid(const X509 *x) PHP_OPENSSL_CHECK_NUMBER_CONVERSION_NULL_RETURN(ZEND_LONG_EXCEEDS_INT(_var), _name) /* {{{ php_openssl_store_errors */ -void php_openssl_store_errors() +void php_openssl_store_errors(void) { struct php_openssl_errors *errors; int error_code = ERR_get_error(); diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index c568339f298cd..dfa2236b982c2 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -3416,7 +3416,7 @@ static void set_xsi_type(xmlNodePtr node, char *type) set_ns_prop(node, XSI_NAMESPACE, "type", type); } -void encode_reset_ns() +void encode_reset_ns(void) { SOAP_GLOBAL(cur_uniq_ns) = 0; SOAP_GLOBAL(cur_uniq_ref) = 0; @@ -3428,7 +3428,7 @@ void encode_reset_ns() zend_hash_init(SOAP_GLOBAL(ref_map), 0, NULL, NULL, 0); } -void encode_finish() +void encode_finish(void) { SOAP_GLOBAL(cur_uniq_ns) = 0; SOAP_GLOBAL(cur_uniq_ref) = 0; diff --git a/ext/standard/crc32.c b/ext/standard/crc32.c index 374fee381593a..512bbc4c3dc89 100644 --- a/ext/standard/crc32.c +++ b/ext/standard/crc32.c @@ -39,7 +39,7 @@ static unsigned long getauxval(unsigned long key) { } # endif -static inline int has_crc32_insn() { +static inline int has_crc32_insn(void) { /* Only go through the runtime detection once. */ static int res = -1; if (res != -1) @@ -68,6 +68,8 @@ static inline int has_crc32_insn() { # if!defined(__clang__) # pragma GCC push_options # pragma GCC target ("+nothing+crc") +# elif defined(__APPLE__) +# pragma clang attribute push(__attribute__((target("crc"))), apply_to=function) # else # pragma clang attribute push(__attribute__((target("+nothing+crc"))), apply_to=function) # endif diff --git a/sapi/fpm/fpm/events/kqueue.c b/sapi/fpm/fpm/events/kqueue.c index 8fc4a6f049b0d..b81650d7741dc 100644 --- a/sapi/fpm/fpm/events/kqueue.c +++ b/sapi/fpm/fpm/events/kqueue.c @@ -96,7 +96,7 @@ static int fpm_event_kqueue_init(int max) /* {{{ */ /* * release kqueue stuff */ -static int fpm_event_kqueue_clean() /* {{{ */ +static int fpm_event_kqueue_clean(void) /* {{{ */ { if (kevents) { free(kevents);