- Notifications
You must be signed in to change notification settings - Fork8k
Closed
Description
Description
The following code:
<?phpclass klass{publicfunctionmethod(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
But I expected this output instead:
php8.1 -l test.php No syntax errors detected in 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 modulezend_extension=opcache.soopcache.enable=1opcache.enable_cli=1opcache.use_cwd=1opcache.max_accelerated_files=20000;2000 par instanceopcache.enable_cli=1opcache.load_comments=0opcache.save_comments=0opcache.memory_consumption=1500;150M par instanceopcache.dups_fix=0opcache.enable_file_override=1opcache.optimization_level=0x7FFEBFFF;devopcache.validate_timestamps=1opcache.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 10001 CV1($bool) = RECV_INIT 2 bool(false)0002 JMP 00040003 PRE_DEC CV0($int)0004 T4 = IS_SMALLER_OR_EQUAL int(0) CV0($int)0005 T4 = JMPZ_EX T4 00080006 T5 = BOOL_NOT CV2($function1)0007 T4 = BOOL T50008 JMPNZ T4 00030009 JMPZ CV1($bool) 00160010 JMP 00120011 PRE_DEC CV0($int)0012 T7 = IS_SMALLER_OR_EQUAL int(0) CV0($int)0013 T7 = JMPZ_EX T7 00150014 T7 = BOOL CV2($function1)0015 JMPNZ T7 00110016 VERIFY_RETURN_TYPE CV0($int)0017 RETURN CV0($int)0018 VERIFY_RETURN_TYPE0019 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.phpphp -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