Skip to content

phpinfo() and "php -i" segfaults with 0.15.0 #182

Closed
@brettmc

Description

@brettmc

Running the example from https://docs.rs/phper-doc/latest/phper_doc/_02_quick_start/_01_write_your_first_extension/index.html#steps segfaults with 0.15.0, but not with 0.14.1. gdb backtrace shows that it occurs when printing module.version.

module.version is "0.1.0" and configured as per the example docs:

let mut module = Module::new(
        env!("CARGO_PKG_NAME"),
        env!("CARGO_PKG_VERSION"),
        env!("CARGO_PKG_AUTHORS"),
    );

gdb --args php -d extension=target/debug/libhello.so -i:

<snip>
hello

version => 
Program received signal SIGSEGV, Segmentation fault.
0x000055b2ab21fe0c in ?? ()
(gdb) bt
#0  0x000055b2ab21fe0c in ?? ()
#1  0x000055b2ab220328 in php_info_print_table_row ()
#2  0x00007fad56b3c16c in phper::modules::module_info (zend_module=0x55b2c325cf20) at src/modules.rs:116
#3  0x000055b2ab220cb8 in php_print_info ()
#4  0x000055b2ab6e0435 in ?? ()
#5  0x000055b2ab24d208 in ?? ()
#6  0x00007fad5983ad7a in __libc_start_main (main=0x55b2ab24cf20, argc=4, argv=0x7ffe37b3a1c8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffe37b3a1b8) at ../csu/libc-start.c:308
#7  0x000055b2ab24d8ca in _start ()

My environment:
php: 8.4.4 (docker php:fpm-8.4-bullseye)
rustc: 1.85.0
llvm-dev is already the newest version (1:11.0-51+nmu5)
libclang-dev is already the newest version (1:11.0-51+nmu5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions