xref: /PHP-8.1/ext/opcache/tests/jit/assign_036.phpt (revision e9f783fc)
1--TEST--
2JIT ASSIGN: Assign with INTERNED string(no RC)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit_buffer_size=1M
8opcache.protect_memory=1
9;opcache.jit_debug=257
10--EXTENSIONS--
11opcache
12--FILE--
13<?php
14class A {
15    public $result = "string";
16    function __set($propName, $propValue)
17    {
18        $oldType = \gettype($this->$propName);
19        $newType = \gettype($propValue);
20        if ($propValue === 'false')
21        {
22            $newType   = 'boolean';
23            $propValue = \false;
24        }
25        elseif ($propValue === 'true')
26        {
27            $newType   = 'boolean';
28            $propValue = \true;
29        }
30        if ($oldType !== $newType)
31        {
32            $tmp = $propValue;
33            \settype($tmp, $newType);
34        }
35        $this->propName = $propValue;
36    }
37}
38$a = new A;
39$a->result = "okey";
40echo $a->result;
41?>
42--EXPECT--
43okey
44