| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  * This file is part of the sj-i/php-profiler package. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * (c) sji <[email protected]> | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * For the full copyright and license information, please view the LICENSE | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * file that was distributed with this source code. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | declare(strict_types=1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | namespace PhpProfiler\Inspector\Settings; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | use PhpProfiler\Lib\PhpInternals\ZendTypeReader; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | use Symfony\Component\Console\Input\InputInterface; | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | final class TargetPhpSettings | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     private const PHP_REGEX_DEFAULT = '.*/(php(74|7.4|80|8.0)?|php-fpm|libphp[78].*\.so)$'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |     private const LIBPTHREAD_REGEX_DEFAULT = '.*/libpthread.*\.so$'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |     private const TARGET_PHP_VERSION_DEFAULT = ZendTypeReader::V74; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |     public string $php_regex; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |     public string $libpthread_regex; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     /** @psalm-var value-of<ZendTypeReader::ALL_SUPPORTED_VERSIONS> $php_version */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |     public string $php_version; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     public ?string $php_path; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |     public ?string $libpthread_path; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |      * GetTraceSettings constructor. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |      * @param string $php_regex | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |      * @param string $libpthread_regex | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |      * @param string $php_version | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |      * @param string|null $php_path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |      * @param string|null $libpthread_path | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |      * @psalm-param value-of<ZendTypeReader::ALL_SUPPORTED_VERSIONS> $php_version | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |     public function __construct( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |         string $php_regex = self::PHP_REGEX_DEFAULT, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         string $libpthread_regex = self::LIBPTHREAD_REGEX_DEFAULT, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         string $php_version = ZendTypeReader::V74, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         ?string $php_path = null, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         ?string $libpthread_path = null | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |     ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         $this->php_regex = '{' . $php_regex . '}'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         $this->libpthread_regex = '{' . $libpthread_regex . '}'; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |         $this->php_version = $php_version; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         $this->php_path = $php_path; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |         $this->libpthread_path = $libpthread_path; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 54 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |     public static function fromConsoleInput(InputInterface $input): self | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 57 |  |  |         $php_regex = $input->getOption('php-regex') ?? self::PHP_REGEX_DEFAULT; | 
            
                                                                        
                            
            
                                    
            
            
                | 58 |  |  |         if (!is_string($php_regex)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 59 |  |  |             throw TargetPhpInspectorSettingsException::create( | 
            
                                                                        
                            
            
                                    
            
            
                | 60 |  |  |                 TargetPhpInspectorSettingsException::PHP_REGEX_IS_NOT_STRING | 
            
                                                                        
                            
            
                                    
            
            
                | 61 |  |  |             ); | 
            
                                                                        
                            
            
                                    
            
            
                | 62 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |         $libpthread_regex = $input->getOption('libpthread-regex') ?? self::LIBPTHREAD_REGEX_DEFAULT; | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |         if (!is_string($libpthread_regex)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |             throw TargetPhpInspectorSettingsException::create( | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |                 TargetPhpInspectorSettingsException::LIBPTHREAD_REGEX_IS_NOT_STRING | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |             ); | 
            
                                                                        
                            
            
                                    
            
            
                | 69 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 70 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |         $php_version = $input->getOption('php-version') ?? self::TARGET_PHP_VERSION_DEFAULT; | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |         if (!in_array($php_version, ZendTypeReader::ALL_SUPPORTED_VERSIONS, true)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  |             throw TargetPhpInspectorSettingsException::create( | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |                 TargetPhpInspectorSettingsException::TARGET_PHP_VERSION_INVALID | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  |             ); | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |         /** @psalm-var value-of<ZendTypeReader::ALL_SUPPORTED_VERSIONS> $php_version */ | 
            
                                                                        
                            
            
                                    
            
            
                | 78 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 79 |  |  |         $php_path = $input->getOption('php-path'); | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  |         if (!is_null($php_path) and !is_string($php_path)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 81 |  |  |             throw TargetPhpInspectorSettingsException::create( | 
            
                                                                        
                            
            
                                    
            
            
                | 82 |  |  |                 TargetPhpInspectorSettingsException::PHP_PATH_IS_NOT_STRING | 
            
                                                                        
                            
            
                                    
            
            
                | 83 |  |  |             ); | 
            
                                                                        
                            
            
                                    
            
            
                | 84 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 85 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 86 |  |  |         $libpthread_path = $input->getOption('libpthread-path'); | 
            
                                                                        
                            
            
                                    
            
            
                | 87 |  |  |         if (!is_null($libpthread_path) and !is_string($libpthread_path)) { | 
            
                                                                        
                            
            
                                    
            
            
                | 88 |  |  |             throw TargetPhpInspectorSettingsException::create( | 
            
                                                                        
                            
            
                                    
            
            
                | 89 |  |  |                 TargetPhpInspectorSettingsException::LIBPTHREAD_PATH_IS_NOT_STRING | 
            
                                                                        
                            
            
                                    
            
            
                | 90 |  |  |             ); | 
            
                                                                        
                            
            
                                    
            
            
                | 91 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 92 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 93 |  |  |         return new self($php_regex, $libpthread_regex, $php_version, $php_path, $libpthread_path); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 95 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 96 |  |  |  | 
            
                        
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths