Might anyone know anything about why PHP crashes ? I've added some debug printf's into the code, and in "PHP_FUNCTION(sqlite3_query_close)" it crashes at "sqlite3_finalize(stmt->stmt)". A printf before that line executes, but not one after.
I'm really not sure how any of it works.. is stmt->stmt a linked list? I somewhat doubt it. Oddly, when I run the script with Valgrind, there're no errors. Running php on the command line, I get a crash.
Might anyone know anything about why PHP crashes ? I've added some debug printf's into the code, and in "PHP_FUNCTION(sqlite3_query_close)" it crashes at "sqlite3_finalize(stmt->stmt)". A printf before that line executes, but not one after.
I'm really not sure how any of it works.. is stmt->stmt a linked list? I somewhat doubt it. Oddly, when I run the script with Valgrind, there're no errors. Running php on the command line, I get a crash.
*** glibc detected *** php: corrupted double-linked list: 0x0000000000ccd300 ***
======= Backtrace: =========
/lib/libc.so.6[0x2ab03002daad]
/lib/libc.so.6[0x2ab03002f1fd]
/lib/libc.so.6(cfree+0x76)[0x2ab03002f796]
/usr/lib/libsqlite3.so.0(sqlite3_free+0x36)[0x2ab03075c7e6]
/usr/lib/libsqlite3.so.0(sqlite3VdbeFinalize+0x52)[0x2ab03077b132]
/usr/lib/libsqlite3.so.0(sqlite3_finalize+0x35)[0x2ab030779525]
/usr/lib64/php5/lib/php/extensions/no-debug-non-zts-20060613/sqlite3.so(zif_sqlite3_query_close+0x93)[0x2ab0305107d3]
php[0x6152cc]
php(execute+0x153)[0x6055e3]
php[0x614d95]
php(execute+0x153)[0x6055e3]
php[0x614d95]
php(execute+0x153)[0x6055e3]
php[0x614d95]
php(execute+0x153)[0x6055e3]
php(zend_execute_scripts+0x123)[0x5e7233]
php(php_execute_script+0x1db)[0x5a6e6b]
php(main+0xe30)[0x66ca50]
/lib/libc.so.6(__libc_start_main+0xf4)[0x2ab02ffdeb74]
php[0x44e879]
Hoho, mere minutes after I posted this, I found a fix by looking up some of the PHP constructs.
http://code.google.com/p/corwin-gentoo/source/browse/gentoo/overlays/extra/dev-php5/php-sqlite3/files/sqlite3-0.5-fix_sqlite3_finalize.patch?r=97
It's mostly about setting stmt->stmt = null when it gets cleared. Took care of the problem.