-
Notifications
You must be signed in to change notification settings - Fork 8k
Expand file tree
/
Copy pathgh21006.phpt
More file actions
59 lines (54 loc) · 995 Bytes
/
gh21006.phpt
File metadata and controls
59 lines (54 loc) · 995 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--TEST--
GH-21006: JIT SEGV with FETCH_OBJ_FUNC_ARG and property hooks
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.jit=tracing
opcache.jit_hot_loop=61
opcache.jit_hot_func=127
opcache.jit_hot_return=8
opcache.jit_hot_side_exit=8
--FILE--
<?php
namespace Test;
class C
{
public $prop {
get => 'sha256';
}
public function sign()
{
return hash_hmac(
algo: $this->prop,
data: '',
key: '',
);
}
}
$obj = new C();
for ($i = 0; $i < 100; $i++) {
$obj->sign();
}
// Dynamic property access through FETCH_OBJ_FUNC_ARG must not corrupt
// the ZEND_DYNAMIC_PROPERTY_OFFSET sentinel in the runtime cache.
#[\AllowDynamicProperties]
class D
{
public function test()
{
return hash_hmac(
algo: $this->algo,
data: '',
key: '',
);
}
}
$d = new D();
$d->algo = 'sha256';
for ($i = 0; $i < 100; $i++) {
$d->test();
}
echo "OK\n";
?>
--EXPECT--
OK