[php-src] Issue #8847: PHP hanging infinitly at 100% when check php syntaxe of a valid file

From: Date: Thu, 23 Jun 2022 08:23:13 +0000
Subject: [php-src] Issue #8847: PHP hanging infinitly at 100% when check php syntaxe of a valid file
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241786@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8847 Author: pierre-dominique ### Description The following code: ```php <?php class klass { public function method(int $int, bool $bool=false) : int { while($int >= 0 && !$function1) $int--; if($bool) while($int >= 0 && $function1) $int--; return $int; } } ``` Resulted in this output: ``` php8.1 -l test.php No syntax errors detected in test.php ``` But I expected this output instead: ``` php8.1 -l test.php ``` hanging infinitely, can't be canceled, sigkill 6 needed. use 100% off one cpu When opcache is disable it's OK When jit in opcache is disable it's OK When jit is opcache.jit = 1255 it's OK when jit is opcache.jit = 1205 its' KO The zero from 1205 look suspicious Here the opcache conf ``` ; configuration for php ZendOpcache module zend_extension=opcache.so opcache.enable=1 opcache.enable_cli=1 opcache.use_cwd=1 opcache.max_accelerated_files=20000 ;2000 par instance opcache.enable_cli=1 opcache.load_comments=0 opcache.save_comments=0 opcache.memory_consumption=1500 ;150M par instance opcache.dups_fix=0 opcache.enable_file_override=1 opcache.optimization_level=0x7FFEBFFF ;dev opcache.validate_timestamps=1 opcache.revalidate_freq=0 ;prod ;opcache.validate_timestamps=1 ;opcache.revalidate_freq=5 ;opcache.consistency_checks=0 ;opcache.file_update_protection=1 ;opcache.jit = disable ; desactive [OK] opcache.jit = 1205 ; init terrible et perfs correctes [OK] opcache.jit_buffer_size = 512M ``` here the output of opcache ``` $_main: ; (lines=1, args=0, vars=0, tmps=0) ; (after pass 1) ; test.php:1-14 ; return [] RANGE[0..0] 0000 RETURN int(1) klass::method: ; (lines=20, args=2, vars=3, tmps=5) ; (after pass 1) ; test.php:4-12 ; return [] RANGE[0..0] 0000 CV0($int) = RECV 1 0001 CV1($bool) = RECV_INIT 2 bool(false) 0002 JMP 0004 0003 PRE_DEC CV0($int) 0004 T4 = IS_SMALLER_OR_EQUAL int(0) CV0($int) 0005 T4 = JMPZ_EX T4 0008 0006 T5 = BOOL_NOT CV2($function1) 0007 T4 = BOOL T5 0008 JMPNZ T4 0003 0009 JMPZ CV1($bool) 0016 0010 JMP 0012 0011 PRE_DEC CV0($int) 0012 T7 = IS_SMALLER_OR_EQUAL int(0) CV0($int) 0013 T7 = JMPZ_EX T7 0015 0014 T7 = BOOL CV2($function1) 0015 JMPNZ T7 0011 0016 VERIFY_RETURN_TYPE CV0($int) 0017 RETURN CV0($int) 0018 VERIFY_RETURN_TYPE 0019 RETURN null ``` =>hanging here To reproduce with docker, php 8.0.x to 8.1.x ``` docker run -it php:8.0.0-zts-buster sh ``` In the console ``` rm -f x.php ; echo "<?php\nclass klass\n{\npublic function method(int \$int, bool \$bool=false) : int\n{\nwhile(\$int >= 0 && !\$function1)\n\$int--;\nif(\$bool)\nwhile(\$int >= 0 && \$function1)\n\$int--;\nreturn \$int;\n}\n}" > x.php ; php -l x.php php -d zend_extension=opcache.so -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.use_cwd=1 -d opcache.max_accelerated_files=20000 -d opcache.enable_cli=1 -d opcache.load_comments=0 -d opcache.save_comments=0 -d opcache.memory_consumption=1500 -d opcache.dups_fix=0 -d opcache.enable_file_override=1 -d opcache.optimization_level=0x7FFEBFFF -d opcache.validate_timestamps=1 -d opcache.revalidate_freq=0 -d opcache.jit=1205 -d opcache.jit_buffer_size=512M -l x.php ``` ### PHP Version PHP 8.0.x and 8.1.x ### Operating System Debian

« previous php.bugs (#241786) next »