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