xref: /PHP-8.3/ext/opcache/tests/jit/bug80745.phpt (revision e9f783fc)
1--TEST--
2Bug #80745 (JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit=function
8opcache.jit_buffer_size=1M
9opcache.protect_memory=1
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14
15final class Message
16{
17    public $qr = false;
18
19    public $opcode = 0;
20
21    public $aa = false;
22}
23
24echo "Starting...\n";
25
26function headerToBinary(Message $message)
27{
28        $flags = 0;
29        $flags = ($flags << 1) | ($message->qr ? 1 : 0);
30        $flags = ($flags << 4) | $message->opcode;
31        var_dump($flags);
32        $flags = ($flags << 1) | ($message->aa ? 1 : 0);
33}
34
35headerToBinary(new Message());
36
37echo "PROBLEM NOT REPRODUCED !\n";
38?>
39--EXPECT--
40Starting...
41int(0)
42PROBLEM NOT REPRODUCED !
43
44