php_client icon indicating copy to clipboard operation
php_client copied to clipboard

RowSet::getNextAggregation() returns AggregationResult but there is no way to read the value in PHP

Open azazar opened this issue 1 month ago • 2 comments

RowSet::getNextAggregation() returns AggregationResult but there is no way to read the value in PHP

azazar avatar Nov 19 '25 12:11 azazar

Calls to AggregationResult::get results SIGEGV.

$aggregation_result->get(Type::INTEGER);
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

Breakpoint 13, 0x00005555557fe0a4 in object_and_properties_init ()
(gdb) whe
#0  0x00005555557fe0a4 in object_and_properties_init ()
#1  0x00007ffff3603ac5 in throwGSException (exception=exception@entry=0x555555cb4c30) at src/griddb_php_client.cxx:1298
#2  0x00007ffff360427f in _wrap_AggregationResult_get (execute_data=0x7ffff5413410, return_value=<optimized out>)
    at src/griddb_php_client.cxx:2233
#3  0x00007ffff563c2fd in xdebug_execute_internal (current_execute_data=0x7ffff5413410, return_value=0x7ffff5413400)
    at ./build-7.4/src/base/base.c:462
#4  0x000055555565358b in ?? ()
#5  0x000055555587deb3 in execute_ex ()
#6  0x00007ffff563b95e in xdebug_execute_ex (execute_data=0x7ffff5413390) at ./build-7.4/src/base/base.c:376
#7  0x00007ffff506d2f5 in ?? () from /opt/ioncube/ioncube_loader_lin_7.4.so
#8  0x00007ffff506f0e0 in ?? () from /opt/ioncube/ioncube_loader_lin_7.4.so
#9  0x0000555555653524 in ?? ()
#10 0x000055555587deb3 in execute_ex ()
#11 0x00007ffff563b95e in xdebug_execute_ex (execute_data=0x7ffff5413020) at ./build-7.4/src/base/base.c:376
#12 0x00007ffff506d2f5 in ?? () from /opt/ioncube/ioncube_loader_lin_7.4.so
#13 0x00007ffff506f0e0 in ?? () from /opt/ioncube/ioncube_loader_lin_7.4.so
#14 0x00005555558855bb in zend_execute ()
#15 0x00005555557fc49c in zend_execute_scripts ()
#16 0x000055555579bf60 in php_execute_script ()
#17 0x00005555558876f2 in ?? ()
#18 0x0000555555661af8 in ?? ()
#19 0x00007ffff764c083 in __libc_start_main (main=0x5555556616f0, argc=2, argv=0x7fffffffdfb8, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7fffffffdfa8) at ../csu/libc-start.c:308
#20 0x00005555556622ce in _start ()
(gdb) dis
disable      disassemble  disconnect   display      
(gdb) dis
disable      disassemble  disconnect   display      
(gdb) dis
disable      disassemble  disconnect   display      
(gdb) disassemble 
Dump of assembler code for function object_and_properties_init:
   0x00005555557fe090 <+0>:     endbr64 
   0x00005555557fe094 <+4>:     push   %r13
   0x00005555557fe096 <+6>:     push   %r12
   0x00005555557fe098 <+8>:     push   %rbp
   0x00005555557fe099 <+9>:     mov    %rsi,%rbp
   0x00005555557fe09c <+12>:    push   %rbx
   0x00005555557fe09d <+13>:    mov    %rdi,%rbx
   0x00005555557fe0a0 <+16>:    sub    $0x8,%rsp
=> 0x00005555557fe0a4 <+20>:    mov    0x1c(%rsi),%eax
   0x00005555557fe0a7 <+23>:    test   $0x53,%al
   0x00005555557fe0a9 <+25>:    jne    0x55555564917e
   0x00005555557fe0af <+31>:    mov    %rdx,%r12
   0x00005555557fe0b2 <+34>:    test   $0x10,%ah
   0x00005555557fe0b5 <+37>:    je     0x5555557fe108 <object_and_properties_init+120>
   0x00005555557fe0b7 <+39>:    mov    0x160(%rbp),%rax
   0x00005555557fe0be <+46>:    mov    %rbp,%rdi
   0x00005555557fe0c1 <+49>:    test   %rax,%rax
   0x00005555557fe0c4 <+52>:    je     0x5555557fe0e0 <object_and_properties_init+80>
   0x00005555557fe0c6 <+54>:    callq  *%rax
   0x00005555557fe0c8 <+56>:    movl   $0x308,0x8(%rbx)
   0x00005555557fe0cf <+63>:    mov    %rax,(%rbx)
   0x00005555557fe0d2 <+66>:    xor    %eax,%eax
   0x00005555557fe0d4 <+68>:    add    $0x8,%rsp
   0x00005555557fe0d8 <+72>:    pop    %rbx
   0x00005555557fe0d9 <+73>:    pop    %rbp
   0x00005555557fe0da <+74>:    pop    %r12
   0x00005555557fe0dc <+76>:    pop    %r13
   0x00005555557fe0de <+78>:    retq   
   0x00005555557fe0df <+79>:    nop
   0x00005555557fe0e0 <+80>:    callq  0x55555582dcc0 <zend_objects_new>
   0x00005555557fe0e5 <+85>:    movl   $0x308,0x8(%rbx)
   0x00005555557fe0ec <+92>:    mov    %rax,(%rbx)
   0x00005555557fe0ef <+95>:    mov    %rax,%rdi
   0x00005555557fe0f2 <+98>:    test   %r12,%r12
   0x00005555557fe0f5 <+101>:   je     0x5555557fe130 <object_and_properties_init+160>
   0x00005555557fe0f7 <+103>:   mov    %r12,%rsi
   0x00005555557fe0fa <+106>:   callq  0x5555557fdc70 <object_properties_init_ex>
   0x00005555557fe0ff <+111>:   xor    %eax,%eax
   0x00005555557fe101 <+113>:   jmp    0x5555557fe0d4 <object_and_properties_init+68>
   0x00005555557fe103 <+115>:   nopl   0x0(%rax,%rax,1)
   0x00005555557fe108 <+120>:   mov    %rsi,%rdi
   0x00005555557fe10b <+123>:   callq  0x5555557fd930 <zend_update_class_constants>
   0x00005555557fe110 <+128>:   test   %eax,%eax
   0x00005555557fe112 <+130>:   je     0x5555557fe0b7 <object_and_properties_init+39>
   0x00005555557fe114 <+132>:   movl   $0x1,0x8(%rbx)
   0x00005555557fe11b <+139>:   mov    $0xffffffff,%eax
   0x00005555557fe120 <+144>:   movq   $0x0,(%rbx)
   0x00005555557fe127 <+151>:   jmp    0x5555557fe0d4 <object_and_properties_init+68>
   0x00005555557fe129 <+153>:   nopl   0x0(%rax)
--Type <RET> for more, q to quit, c to continue without paging-- 
   0x00005555557fe130 <+160>:   movslq 0x20(%rbp),%rax
   0x00005555557fe134 <+164>:   test   %eax,%eax
   0x00005555557fe136 <+166>:   je     0x5555557fe0d2 <object_and_properties_init+66>
   0x00005555557fe138 <+168>:   mov    0x28(%rbp),%r12
   0x00005555557fe13c <+172>:   shl    $0x4,%rax
   0x00005555557fe140 <+176>:   cmpb   $0x1,0x0(%rbp)
   0x00005555557fe144 <+180>:   lea    0x28(%rdi),%rbx
   0x00005555557fe148 <+184>:   lea    (%r12,%rax,1),%r13
   0x00005555557fe14c <+188>:   je     0x5555557fe188 <object_and_properties_init+248>
   0x00005555557fe14e <+190>:   xchg   %ax,%ax
   0x00005555557fe150 <+192>:   mov    (%r12),%rax
   0x00005555557fe154 <+196>:   mov    0x8(%r12),%edx
   0x00005555557fe159 <+201>:   mov    %rax,(%rbx)
   0x00005555557fe15c <+204>:   mov    %edx,0x8(%rbx)
   0x00005555557fe15f <+207>:   and    $0xff,%dh
   0x00005555557fe162 <+210>:   je     0x5555557fe167 <object_and_properties_init+215>
   0x00005555557fe164 <+212>:   addl   $0x1,(%rax)
   0x00005555557fe167 <+215>:   mov    0xc(%r12),%eax
   0x00005555557fe16c <+220>:   add    $0x10,%r12
   0x00005555557fe170 <+224>:   add    $0x10,%rbx
   0x00005555557fe174 <+228>:   mov    %eax,-0x4(%rbx)
   0x00005555557fe177 <+231>:   cmp    %r12,%r13
   0x00005555557fe17a <+234>:   jne    0x5555557fe150 <object_and_properties_init+192>
   0x00005555557fe17c <+236>:   jmpq   0x5555557fe0d2 <object_and_properties_init+66>
   0x00005555557fe181 <+241>:   nopl   0x0(%rax)
   0x00005555557fe188 <+248>:   mov    (%r12),%rax
   0x00005555557fe18c <+252>:   mov    0x8(%r12),%edx
   0x00005555557fe191 <+257>:   mov    %rax,(%rbx)
   0x00005555557fe194 <+260>:   mov    %edx,0x8(%rbx)
   0x00005555557fe197 <+263>:   and    $0xff,%dh
   0x00005555557fe19a <+266>:   je     0x5555557fe1a5 <object_and_properties_init+277>
   0x00005555557fe19c <+268>:   testb  $0x80,0x4(%rax)
   0x00005555557fe1a0 <+272>:   jne    0x5555557fe1bf <object_and_properties_init+303>
   0x00005555557fe1a2 <+274>:   addl   $0x1,(%rax)
   0x00005555557fe1a5 <+277>:   mov    0xc(%r12),%eax
   0x00005555557fe1aa <+282>:   add    $0x10,%r12
   0x00005555557fe1ae <+286>:   add    $0x10,%rbx
   0x00005555557fe1b2 <+290>:   mov    %eax,-0x4(%rbx)
   0x00005555557fe1b5 <+293>:   cmp    %r12,%r13
   0x00005555557fe1b8 <+296>:   jne    0x5555557fe188 <object_and_properties_init+248>
   0x00005555557fe1ba <+298>:   jmpq   0x5555557fe0d2 <object_and_properties_init+66>
   0x00005555557fe1bf <+303>:   mov    %rbx,%rdi
   0x00005555557fe1c2 <+306>:   callq  0x5555557fa230 <zval_copy_ctor_func>
   0x00005555557fe1c7 <+311>:   jmp    0x5555557fe1a5 <object_and_properties_init+277>
End of assembler dump.
(gdb) si

Program received signal SIGSEGV, Segmentation fault.
0x00005555557fe0a4 in object_and_properties_init ()

azazar avatar Nov 19 '25 12:11 azazar

Thank you for your usage and report.

$row->get(Type::INTEGER);

Could you input not Type::INTEGER but Type::LONG like sample/TQLAggregation.php ?

We must provide GridDB data type to the input of AggregationResult::get method.

| PHP data type  | GridDB data type | description    |
|----------------|------------------|----------------|
| int            | Type::LONG       | 64-bit integer |
| float          | Type::DOUBLE     | 64-bit float   |
| datetime       | Type::TIMESTAMP  |                |

I will review the API reference. And I will also check the error handling.

knonomura avatar Nov 25 '25 08:11 knonomura