-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add runtime type inference verification #12930
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,9 +38,9 @@ permissions: | |
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.url || github.run_id }} | ||
cancel-in-progress: true | ||
env: | ||
CC: ccache gcc | ||
CXX: ccache g++ | ||
# env: | ||
# CC: ccache gcc | ||
# CXX: ccache g++ | ||
Comment on lines
-41
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is a problem with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is just for debugging. All changes from |
||
jobs: | ||
LINUX_X64: | ||
services: | ||
|
@@ -121,7 +121,7 @@ jobs: | |
configurationParameters: >- | ||
--${{ matrix.debug && 'enable' || 'disable' }}-debug | ||
--${{ matrix.zts && 'enable' || 'disable' }}-zts | ||
${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -fno-sanitize=pointer-overflow -DZEND_TRACK_ARENA_ALLOC" LDFLAGS="-fsanitize=undefined,address -fno-sanitize=pointer-overflow" CC=clang-16 CXX=clang++-16' || '' }} | ||
${{ matrix.asan && 'CFLAGS="-fsanitize=undefined,address -fno-sanitize=pointer-overflow -DZEND_TRACK_ARENA_ALLOC -DZEND_VERIFY_TYPE_INFERENCE" LDFLAGS="-fsanitize=undefined,address -fno-sanitize=pointer-overflow" CC=clang-16 CXX=clang++-16' || '' }} | ||
skipSlow: ${{ matrix.asan }} | ||
- name: make | ||
run: make -j$(/usr/bin/nproc) >/dev/null | ||
|
@@ -148,6 +148,7 @@ jobs: | |
if: ${{ !matrix.asan }} | ||
uses: ./.github/actions/verify-generated-files | ||
MACOS_DEBUG_NTS: | ||
if: false | ||
runs-on: macos-13 | ||
steps: | ||
- name: git checkout | ||
|
@@ -180,6 +181,7 @@ jobs: | |
- name: Verify generated files are up to date | ||
uses: ./.github/actions/verify-generated-files | ||
WINDOWS: | ||
if: false | ||
name: WINDOWS_X64_ZTS | ||
runs-on: windows-2019 | ||
env: | ||
|
@@ -206,7 +208,8 @@ jobs: | |
run: .github/scripts/windows/test.bat | ||
BENCHMARKING: | ||
name: BENCHMARKING | ||
if: github.repository_owner == 'php' || github.event_name == 'pull_request' | ||
# if: github.repository_owner == 'php' || github.event_name == 'pull_request' | ||
if: false | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: git checkout | ||
|
@@ -305,3 +308,155 @@ jobs: | |
name: profiles | ||
path: ${{ github.workspace }}/benchmark/profiles | ||
retention-days: 30 | ||
COMMUNITY: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
type: ['verify_type_inference'] | ||
name: "COMMUNITY_verify_type_inference" | ||
runs-on: ubuntu-22.04 | ||
env: | ||
ASAN_OPTIONS: exitcode=139 | ||
UBSAN_OPTIONS: print_stacktrace=1 | ||
USE_ZEND_ALLOC: 0 | ||
USE_TRACKED_ALLOC: 1 | ||
steps: | ||
- name: git checkout | ||
uses: actions/checkout@v4 | ||
- name: apt | ||
uses: ./.github/actions/apt-x64 | ||
- name: ./configure | ||
uses: ./.github/actions/configure-x64 | ||
with: | ||
# CFLAGS removes O2, so we have to add it again... | ||
configurationParameters: >- | ||
--enable-zts | ||
CFLAGS="-DZEND_VERIFY_TYPE_INFERENCE -O2" | ||
- name: make | ||
run: make -j$(/usr/bin/nproc) >/dev/null | ||
- name: make install | ||
uses: ./.github/actions/install-linux | ||
- name: Setup | ||
run: | | ||
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 | ||
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.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: 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 | ||
run: | | ||
git clone https://github.com/laravel/framework.git --branch=master --depth=1 | ||
cd framework | ||
git rev-parse HEAD | ||
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);' | ||
php vendor/bin/phpunit --exclude-group skip || EXIT_CODE=$? | ||
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 | ||
run: | | ||
git clone https://github.com/symfony/symfony.git --depth=1 | ||
cd symfony | ||
git rev-parse HEAD | ||
php /usr/bin/composer install --no-progress --ignore-platform-reqs | ||
php ./phpunit install | ||
# Test causes a heap-buffer-overflow but I cannot reproduce it locally... | ||
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 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:-0} -gt 128 ]; then | ||
X=1; | ||
fi | ||
done | ||
exit $X | ||
- name: Test PHPUnit | ||
if: always() | ||
run: | | ||
git clone https://github.com/sebastianbergmann/phpunit.git --branch=main --depth=1 | ||
cd phpunit | ||
git rev-parse HEAD | ||
php /usr/bin/composer install --no-progress --ignore-platform-reqs | ||
php ./phpunit || EXIT_CODE=$? | ||
if [ ${EXIT_CODE:-0} -gt 128 ]; then | ||
exit 1 | ||
fi | ||
- name: 'Symfony Preloading' | ||
run: | | ||
php /usr/bin/composer create-project symfony/symfony-demo symfony_demo --no-progress --ignore-platform-reqs | ||
cd symfony_demo | ||
git rev-parse HEAD | ||
sed -i 's/PHP_SAPI/"cli-server"/g' var/cache/dev/App_KernelDevDebugContainer.preload.php | ||
php -d opcache.preload=var/cache/dev/App_KernelDevDebugContainer.preload.php public/index.php | ||
- name: Test Wordpress | ||
if: always() | ||
run: | | ||
git clone https://github.com/WordPress/wordpress-develop.git wordpress --depth=1 | ||
cd wordpress | ||
git rev-parse HEAD | ||
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 | ||
sed -i 's/yourusernamehere/root/g' wp-tests-config.php | ||
sed -i 's/yourpasswordhere/root/g' wp-tests-config.php | ||
php vendor/bin/phpunit || EXIT_CODE=$? | ||
if [ $EXIT_CODE -gt 128 ]; then | ||
exit 1 | ||
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.