|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-02-05 00:47 UTC] zefram at zefram dot net
Description:
------------
I've installed bcompiler .7 using PECL on FreeBSD. I've
written a script to compile all of my PHP code into
separate files.. either based off of the original file, or
alternatively compiled a class into it's own file. In
order to load the compiled code, I simple have a
include_once in an __autoload, which loads the correct
file.
When I compile the original file, I receive a Segmentation
Fault. When I compile the classes, I receive a Bus Error.
Here's my configure line:
./configure --with-apache=../apache_1.3.33/ --with-mysql
--with-gd --enable-sockets
--with-png-dir=/usr/include/libpng
--with-zlib-dir=/usr/include
--with-jpeg-dir=/usr/include/libjpeg --with-mhash
--with-pdflib --disable-ipv6 --with-dom --with-openssl
Reproduce code:
---------------
Here's the class compiler excerpt:
$fh = fopen("/usr/www/compiled/" . $out . ".class.phpb", "w");
bcompiler_write_header($fh);
bcompiler_write_class($fh, $out);
bcompiler_write_footer($fh);
fclose($fh);
And to load, I tried both:
$fh = fopen("/usr/www/compiled/" . $file,"r");
bcompiler_read($fh);
fclose($fh);
And:
include_once($file);
Actual result:
--------------
Here's the BUS ERROR:
#0 0x080aa733 in _efree ()
#1 0x080b62d2 in destroy_zend_class ()
#2 0x080c60a8 in zend_hash_clean ()
#3 0x080c6191 in zend_hash_apply ()
#4 0x080b2ef9 in shutdown_executor ()
#5 0x080bdf45 in zend_deactivate ()
#6 0x08091b11 in php_request_shutdown ()
#7 0x081336c2 in apache_php_module_main ()
#8 0x0808a78b in ap_get_server_built ()
#9 0x0808a7e9 in ap_get_server_built ()
#10 0x082cccda in ap_invoke_handler ()
#11 0x082e1a9d in ap_some_auth_required ()
#12 0x082e1afc in ap_process_request ()
#13 0x082d8bc3 in ap_child_terminate ()
#14 0x082d8dd0 in ap_child_terminate ()
#15 0x082d8f37 in ap_child_terminate ()
#16 0x082d9586 in ap_child_terminate ()
#17 0x082d9d9f in main ()
Here's the SIGSEGV:
#0 0x080aa733 in _efree ()
#1 0x080b62d2 in destroy_zend_class ()
#2 0x080c60a8 in zend_hash_clean ()
#3 0x080c6191 in zend_hash_apply ()
#4 0x080b2ef9 in shutdown_executor ()
#5 0x080bdf45 in zend_deactivate ()
#6 0x08091b11 in php_request_shutdown ()
#7 0x081336c2 in apache_php_module_main ()
#8 0x0808a78b in ap_get_server_built ()
#9 0x0808a7e9 in ap_get_server_built ()
#10 0x082cccda in ap_invoke_handler ()
#11 0x082e1a9d in ap_some_auth_required ()
#12 0x082e1afc in ap_process_request ()
#13 0x082d8bc3 in ap_child_terminate ()
#14 0x082d8dd0 in ap_child_terminate ()
#15 0x082d8f37 in ap_child_terminate ()
#16 0x082d9586 in ap_child_terminate ()
#17 0x082d9d9f in main ()
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 14:00:01 2025 UTC |
A couple of things... sorry, this comment will be messy. If you would like me to email anything, please ask. I stopped using bcompiler_write_class, because it wouldn't work.. and used _write_file. That's how I got it to work.. I installed the CVS, and first tried to get it to work with 5.0.4. It didn't... Here's a udiff that gets it to compile: --- bcompiler.c.orig Tue Feb 7 15:07:59 2006 +++ bcompiler.c Tue Feb 7 15:10:10 2006 @@ -2807,7 +2807,11 @@ /* new for 0.12 */ if (BCOMPILERG(current_write) >= 0x000c) { BCOMPILER_DEBUG(("-----------------------------\nDEFAULT STATIC MEMBERS:\n")); +#ifdef ZEND_ENGINE_2_1 apc_serialize_hashtable(&zce->default_static_members, apc_serialize_zval_ptr TSRMLS_CC); +#else + apc_serialize_hashtable(&zce->static_members, apc_serialize_zval_ptr TSRMLS_CC); +#endif } /* not sure if statics should be dumped... (val: surely not for ZE v2.1) */ BCOMPILER_DEBUG(("-----------------------------\nSTATICS?: \n")); @@ -2994,7 +2998,11 @@ BCOMPILER_DEBUG(("-----------------------------\nDEFAULT STATIC MEMBERS:\n")); DESERIALIZE_SCALAR(&exists, char); apc_deserialize_hashtable( +#ifdef ZEND_ENGINE_2_1 &zce->default_static_members, +#else + &zce->static_members, +#endif (void*) apc_create_zval, (void*) NULL, (int) sizeof(zval *), It compiles and works, but I get the following errors: /usr/local/src/bcompiler-0.7/bcompiler.c:1334:8: warning: extra tokens at end of #endif directive /usr/local/src/bcompiler-0.7/bcompiler.c: In function `apc_serialize_zend_class_entry': /usr/local/src/bcompiler-0.7/bcompiler.c:2813: warning: passing arg 1 of `apc_serialize_hashtable' from incompatible pointer type /usr/local/src/bcompiler-0.7/bcompiler.c: In function `apc_deserialize_zend_class_entry': /usr/local/src/bcompiler-0.7/bcompiler.c:3009: warning: passing arg 1 of `apc_deserialize_hashtable' from incompatible pointer type Then I upgraded to 5.1.2, it compiled fine... the only error was about the extra tokens at the end of #endif. I had to recompile the PHP files with bcompiler, however, but then it worked fine. I'll let you close this out, in case there's any more testing you would like me to do.