xref: /php-src/ext/opcache/tests/jit/bug80745.phpt (revision c16ad918)
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.protect_memory=1
9--EXTENSIONS--
10opcache
11--FILE--
12<?php
13
14final class Message
15{
16    public $qr = false;
17
18    public $opcode = 0;
19
20    public $aa = false;
21}
22
23echo "Starting...\n";
24
25function headerToBinary(Message $message)
26{
27        $flags = 0;
28        $flags = ($flags << 1) | ($message->qr ? 1 : 0);
29        $flags = ($flags << 4) | $message->opcode;
30        var_dump($flags);
31        $flags = ($flags << 1) | ($message->aa ? 1 : 0);
32}
33
34headerToBinary(new Message());
35
36echo "PROBLEM NOT REPRODUCED !\n";
37?>
38--EXPECT--
39Starting...
40int(0)
41PROBLEM NOT REPRODUCED !
42
43