Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
brettmc opened this issue Feb 28, 2025 · 0 comments · Fixed by #183
Closed

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

brettmc opened this issue Feb 28, 2025 · 0 comments · Fixed by #183

Comments

@brettmc
Copy link
Contributor

brettmc commented Feb 28, 2025

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)

@brettmc brettmc changed the title phpinfo() segfaults with 0.15.0 phpinfo() and "php -i" segfaults with 0.15.0 Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant