|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2021-05-14 21:19 UTC] mvorisek at mvorisek dot cz
Description: ------------ see https://github.com/mvorisek/phpstan-src/compare/00ff86b2eab4f8e67170394ca105ad65ba4b1104...13fb7e5f85cc7f053655d5e6529767da8b98bd26 Phpstan does not finish when opcache is enabled on Windows. I belive this is a bug in PHP, as opcache should not affect script execution and also because this bug is present on Windows OS only (NOT on Ubuntu). Test script: --------------- Github Actions workflow to reproduce on https://github.com/phpstan/phpstan-src repo. on: push: jobs: build: runs-on: "${{ matrix.runs-on }}" strategy: fail-fast: false matrix: runs-on: - "ubuntu-latest" - "windows-latest" php-version: - "7.4" - "8.0" ts: - "ts" - "nts" exclude: - runs-on: "ubuntu-latest" ts: ts steps: - name: Checkout uses: actions/checkout@v2 - name: Setup PHP uses: shivammathur/setup-php@v2 with: php-version: "${{ matrix.php-version }}" extensions: intl env: phpts: "${{ matrix.ts }}" - name: "Install phpstan deps" env: COMPOSER_ROOT_VERSION: "0.12.x-dev" run: | composer install - name: "Clone & install test repo" run: | cd repro git clone https://github.com/atk4/ui.git && cd ui composer install - name: "Run PHPStan" run: | cd repro/ui php --version php ../../bin/phpstan clear-result-cache php -d memory_limit=2G ../../bin/phpstan analyse --ansi --debug --verbose - name: "Run PHPStan /w opcache enabled for CLI" run: | cd repro/ui php --version php ../../bin/phpstan clear-result-cache php -d memory_limit=2G -d opcache.enable=1 -d opcache.enable_cli=1 ../../bin/phpstan analyse --ansi --debug --verbose Expected result: ---------------- phpstan finish on Windows (like it does on Ubuntu) Actual result: -------------- error during class fetch PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 13:00:02 2025 UTC |
To be clear, when you say "does not finish" you are talking about this fatal error, not about an infinite loop? PHP Fatal error: During class fetch: Uncaught PHPStan\Broker\ClassAutoloadingException: Class Atk4\Core\ReadableCaptionTrait not found. in D:\a\phpstan-src\phpstan-src\src\Reflection\Runtime\RuntimeReflectionProvider.php:186 Stack trace: #0 [internal function]: PHPStan\Reflection\Runtime\RuntimeReflectionProvider->PHPStan\Reflection\Runtime\{closure}() #1 D:\a\phpstan-src\phpstan-src\repro\ui\vendor\atk4\data\src\Field.php(17): spl_autoload_call() #2 D:\a\phpstan-src\phpstan-src\vendor\composer\ClassLoader.php(478): include('D:\\a\\phpstan-sr...') #3 D:\a\phpstan-src\phpstan-src\vendor\composer\ClassLoader.php(346): Composer\Autoload\includeFile() #4 [internal function]: Composer\Autoload\ClassLoader->loadClass() #5 [internal function]: spl_autoload_call() #6 D:\a\phpstan-src\phpstan-src\src\Reflection\Runtime\RuntimeReflectionProvider.php(191): class_exists() #7 D:\a\phpstan-src\phpstan-src\src\Reflection\ReflectionProvider\ClassBlacklistReflectionProvider.php(49): PHPStan\Reflection\Runtime\RuntimeReflectionProvider->hasCla in D:\a\phpstan-src\phpstan-src\repro\ui\vendor\atk4\data\src\Field.php on line 17 Fatal error: During class fetch: Uncaught PHPStan\Broker\ClassAutoloadingException: Class Atk4\Core\ReadableCaptionTrait not found. in D:\a\phpstan-src\phpstan-src\src\Reflection\Runtime\RuntimeReflectionProvider.php:186 Stack trace: #0 [internal function]: PHPStan\Reflection\Runtime\RuntimeReflectionProvider->PHPStan\Reflection\Runtime\{closure}() #1 D:\a\phpstan-src\phpstan-src\repro\ui\vendor\atk4\data\src\Field.php(17): spl_autoload_call() #2 D:\a\phpstan-src\phpstan-src\vendor\composer\ClassLoader.php(478): include('D:\\a\\phpstan-sr...') #3 D:\a\phpstan-src\phpstan-src\vendor\composer\ClassLoader.php(346): Composer\Autoload\includeFile() #4 [internal function]: Composer\Autoload\ClassLoader->loadClass() #5 [internal function]: spl_autoload_call() #6 D:\a\phpstan-src\phpstan-src\src\Reflection\Runtime\RuntimeReflectionProvider.php(191): class_exists() #7 D:\a\phpstan-src\phpstan-src\src\Reflection\ReflectionProvider\ClassBlacklistReflectionProvider.php(49): PHPStan\Reflection\Runtime\RuntimeReflectionProvider->hasCla in D:\a\phpstan-src\phpstan-src\repro\ui\vendor\atk4\data\src\Field.php on line 17I see the same problem with Ubuntu. Here is the content of an empty/broken opcache file. (I expected more content in the file) > cat /var/tmp/php7.4/opcache/377076abe2ab6ee0c4975c2061101f72/home/comain/vdmg/App/scripts/githooks/StandardVdmg/PHPStanHelper/MeerxErrorFormatter.php.bin OPCACHE377076abe2ab6ee0c4975c2061101f72���ib4kX���@P`�?k�p@������������ib�@X�~jkbF�[��#�Y/home/comain/vdmg/App/scripts/githooks/StandardVdmg/PHPStanHelper/MeerxErrorFormatter.phpA����>F�[��#�Y/home/comain/vdmg/App/scripts/githooks/StandardVdmg/PHPStanHelper/MeerxErrorFormatter.php ---------------------- - System-Info ---------------------- > cat /etc/issue Ubuntu 18.04.6 LTS > php -v PHP 7.4.29 (cli) (built: Apr 21 2022 10:16:17) ( NTS ) > cat /etc/php/7.4/cli/conf.d/50-opcache.ini ``` [opcache] ; Determines if Zend OPCache is enabled opcache.enable=1 ; Determines if Zend OPCache is enabled for the CLI version of PHP opcache.enable_cli=1 ; The OPcache shared memory storage size. opcache.memory_consumption=1024 ; The amount of memory for interned strings in Mbytes. opcache.interned_strings_buffer=64 ; The maximum number of keys (scripts) in the OPcache hash table. ; Only numbers between 200 and 100000 are allowed. opcache.max_accelerated_files=100000 ; The maximum percentage of "wasted" memory until a restart is scheduled. ;opcache.max_wasted_percentage=5 ; When this directive is enabled, the OPcache appends the current working ; directory to the script key, thus eliminating possible collisions between ; files with the same name (basename). Disabling the directive improves ; performance, but may break existing applications. opcache.use_cwd=1 ; When disabled, you must reset the OPcache manually or restart the ; webserver for changes to the filesystem to take effect. opcache.validate_timestamps=1 ; How often (in seconds) to check file timestamps for changes to the shared ; memory storage allocation. ("1" means validate once per second, but only ; once per request. "0" means always validate) opcache.revalidate_freq=0 ; For php-cli always validate php files ; File based OPCache (persistent opcode cache) opcache.file_cache=/var/tmp/php7.4/opcache opcache.file_cache_only=1 ; For php-cli use file-cache only opcache.file_cache_consistency_checks=1 ```