File tree Expand file tree Collapse file tree 1 file changed +96
-0
lines changed
Expand file tree Collapse file tree 1 file changed +96
-0
lines changed Original file line number Diff line number Diff line change 1+ --TEST--
2+ FFI/JIT 044: Write Struct (nested array - FETCH_DIM_W/VAR)
3+ --EXTENSIONS--
4+ ffi
5+ --INI--
6+ ffi.enable=1
7+ ;opcache.jit=tracing
8+ opcache.jit_hot_loop=1
9+ opcache.jit_hot_func=0
10+ opcache.jit_hot_return=0
11+ opcache.jit_hot_side_exit=0
12+ ;opcache.jit_debug=0x180005
13+ --FILE--
14+ <?php
15+ function test () {
16+ $ a = FFI ::cdef ()->new ("struct {int32_t a[5][5]; int32_t b;} " );
17+ for ($ i = 0 ; $ i < 5 ; $ i ++) {
18+ $ a ->a [$ i ][$ i ] = $ i ;
19+ }
20+ var_dump ($ a );
21+ }
22+ test ();
23+ ?>
24+ --EXPECTF--
25+ object(FFI\CData:struct <anonymous>)#%d (2) {
26+ ["a"]=>
27+ object(FFI\CData:int32_t[5][5])#%d (5) {
28+ [0]=>
29+ object(FFI\CData:int32_t[5])#%d (5) {
30+ [0]=>
31+ int(0)
32+ [1]=>
33+ int(0)
34+ [2]=>
35+ int(0)
36+ [3]=>
37+ int(0)
38+ [4]=>
39+ int(0)
40+ }
41+ [1]=>
42+ object(FFI\CData:int32_t[5])#%d (5) {
43+ [0]=>
44+ int(0)
45+ [1]=>
46+ int(1)
47+ [2]=>
48+ int(0)
49+ [3]=>
50+ int(0)
51+ [4]=>
52+ int(0)
53+ }
54+ [2]=>
55+ object(FFI\CData:int32_t[5])#%d (5) {
56+ [0]=>
57+ int(0)
58+ [1]=>
59+ int(0)
60+ [2]=>
61+ int(2)
62+ [3]=>
63+ int(0)
64+ [4]=>
65+ int(0)
66+ }
67+ [3]=>
68+ object(FFI\CData:int32_t[5])#%d (5) {
69+ [0]=>
70+ int(0)
71+ [1]=>
72+ int(0)
73+ [2]=>
74+ int(0)
75+ [3]=>
76+ int(3)
77+ [4]=>
78+ int(0)
79+ }
80+ [4]=>
81+ object(FFI\CData:int32_t[5])#%d (5) {
82+ [0]=>
83+ int(0)
84+ [1]=>
85+ int(0)
86+ [2]=>
87+ int(0)
88+ [3]=>
89+ int(0)
90+ [4]=>
91+ int(4)
92+ }
93+ }
94+ ["b"]=>
95+ int(0)
96+ }
You can’t perform that action at this time.
0 commit comments