1--TEST-- 2JIT Shift Right: 002 3--INI-- 4opcache.enable=1 5opcache.enable_cli=1 6opcache.file_update_protection=0 7opcache.jit_buffer_size=1M 8opcache.protect_memory=1 9--SKIPIF-- 10<?php require_once('skipif.inc'); ?> 11--FILE-- 12<?php 13function shr0(int $a) { 14 return $a >> 0; 15} 16function shr1(int $a) { 17 return $a >> 1; 18} 19function shr2(int $a) { 20 return $a >> 2; 21} 22function shr64(int $a) { 23 return $a >> 64; 24} 25function shrNEG(int $a) { 26 return $a >> -1; 27} 28var_dump(shr0(256)); 29var_dump(shr1(256)); 30var_dump(shr2(256)); 31var_dump(shr2(-8)); 32try { 33 var_dump(shr64(1)); 34} catch (Throwable $e) { 35 echo "Exception " . $e->getMessage() . "\n"; 36} 37try { 38 var_dump(shr64(-1)); 39} catch (Throwable $e) { 40 echo "Exception " . $e->getMessage() . "\n"; 41} 42try { 43 var_dump(shrNEG(1)); 44} catch (Throwable $e) { 45 echo "Exception (" . get_class($e) . "): " . $e->getMessage() . "\n"; 46} 47?> 48--EXPECT-- 49int(256) 50int(128) 51int(64) 52int(-2) 53int(0) 54int(-1) 55Exception (ArithmeticError): Bit shift by negative number 56