1--TEST-- 2JIT Shift Right: 001 3--INI-- 4opcache.enable=1 5opcache.enable_cli=1 6opcache.file_update_protection=0 7opcache.jit_buffer_size=1M 8opcache.protect_memory=1 9--EXTENSIONS-- 10opcache 11--FILE-- 12<?php 13function shr(int $a, int $b) { 14 return $a >> $b; 15} 16var_dump(shr(256, 0)); 17var_dump(shr(256, 1)); 18var_dump(shr(256, 2)); 19var_dump(shr(-8, 2)); 20try { 21 var_dump(shr(1, 64)); 22} catch (Throwable $e) { 23 echo "Exception " . $e->getMessage() . "\n"; 24} 25try { 26 var_dump(shr(-1, 64)); 27} catch (Throwable $e) { 28 echo "Exception " . $e->getMessage() . "\n"; 29} 30try { 31 var_dump(shr(1, -1)); 32} catch (Throwable $e) { 33 echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; 34} 35?> 36--EXPECT-- 37int(256) 38int(128) 39int(64) 40int(-2) 41int(0) 42int(-1) 43Exception (ArithmeticError): Bit shift by negative number 44