swoole / phpy

Connecting the Python and PHP ecosystems together
Apache License 2.0
542 stars 44 forks source link

fix core dump when key wasn’t string. #23

Closed netyum closed 11 months ago

netyum commented 11 months ago
{"('sum', '数量')":256.0,"('mean', '数量')":4.1967213115}
array(2) {
  ["('sum', '数量')"]=>
  float(256)
  ["('mean', '数量')"]=>
  float(4.19672131147541)
}
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `php pandas.php'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000055ffb2b60273 in add_assoc_zval_ex ()
[Current thread is 1 (Thread 0x7fd7cacc9e00 (LWP 9483))]
(gdb) bt
#0  0x000055ffb2b60273 in add_assoc_zval_ex ()
#1  0x00007fd7ca6ce55f in dict2array (pv=0x7fd7add88b00, zv=0x7fd7caa142f0) at /home/ubuntu/phpy/src/bridge/core.cc:252
#2  0x00007fd7ca6d2057 in zim_PyCore_scalar (execute_data=<optimized out>, return_value=0x7fd7caa142f0) at /home/ubuntu/phpy/src/php/core.cc:160
#3  0x000055ffb2cb0b74 in execute_ex ()
#4  0x000055ffb2cca1d7 in zend_execute ()
#5  0x000055ffb2b56ae2 in zend_execute_scripts ()
#6  0x000055ffb2a875f2 in php_execute_script ()
#7  0x000055ffb2df6fd7 in do_cli ()
#8  0x000055ffb2df85a5 in main ()
matyhtf commented 11 months ago

@netyum 需要加一个 phpunit 测试

netyum commented 11 months ago

添加到了DictTest里