1--TEST-- 2JIT Shift Right: 002 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 shr0(int $a) { 13 return $a >> 0; 14} 15function shr1(int $a) { 16 return $a >> 1; 17} 18function shr2(int $a) { 19 return $a >> 2; 20} 21function shr64(int $a) { 22 return $a >> 64; 23} 24function shrNEG(int $a) { 25 return $a >> -1; 26} 27var_dump(shr0(256)); 28var_dump(shr1(256)); 29var_dump(shr2(256)); 30var_dump(shr2(-8)); 31try { 32 var_dump(shr64(1)); 33} catch (Throwable $e) { 34 echo "Exception " . $e->getMessage() . "\n"; 35} 36try { 37 var_dump(shr64(-1)); 38} catch (Throwable $e) { 39 echo "Exception " . $e->getMessage() . "\n"; 40} 41try { 42 var_dump(shrNEG(1)); 43} catch (Throwable $e) { 44 echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; 45} 46?> 47--EXPECT-- 48int(256) 49int(128) 50int(64) 51int(-2) 52int(0) 53int(-1) 54Exception (ArithmeticError): Bit shift by negative number 55