|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-10-31 09:53 UTC] drxor at intellaxiom dot com
I have an extension which is working well in PHP 4.2.2 but when I compile it with PHP 4.2.3. The scripting engin crash on the end of the script several times. I comment out the zend_get_parameters_ex and put static parameters and the script work well.
There is the function in my extension (every function using parameter may crash PHP)
PHP_FUNCTION(ia_open)
{
zval **spHost_arg, **spPort_arg;
char *spHost = NULL;
char *spPort = NULL;
TIA_Stream* olStream;
TIA_Stream* olResStream;
TIA_Writer* olWriter;
TIA_Reader* olReader;
int sockfd;
int nlRes=-1;
//If I use this it may crash PHP
#if 0
if (ZEND_NUM_ARGS() != 2 || /*this part may crash PHP*/zend_get_parameters_ex(2, &spHost_arg, &spPort_arg) == FAILURE){
WRONG_PARAM_COUNT;
}
convert_to_string_ex(spHost_arg);
spHost = Z_STRVAL_PP(spHost_arg);
convert_to_string_ex(spPort_arg);
spPort = Z_STRVAL_PP(spPort_arg);
#else //It's ok with this code
spHost = "xxxxx";
spPort = "1111";
#endif
sockfd = connecttounix();
olStream = new TIA_Stream();
olWriter = new TIA_Writer(olStream);
olWriter->WriteInteger (knIA_Open);
olWriter->WriteString (spHost);
olWriter->WriteString (spPort);
delete olWriter;
olResStream = new TIA_Stream();
if ( request(sockfd, olStream, olResStream) == 0)
{
olReader = new TIA_Reader(olResStream);
nlRes = olReader->ReadInteger();
delete olReader;
}
delete olResStream;
delete olStream;
disconnectfromunix(sockfd);
RETURN_LONG (nlRes);
}
There is some output of PHPINFO
System Linux orion 2.4.12 #1 Wed Oct 24 03:59:50 EDT 2001 i686 unknown
Build Date Oct 28 2002 09:54:34
Configure Command './configure' '--with-mysql=/usr' '--with-apxs' '--with-interbase=/opt/interbase' '--with-gettext' '--with-xml' '--with-gd' '--with-png-dir=/usr' '--with-zlib-dir=/usr' '--with-imap=../imap-2002.RC8' '--with-imap-ssl=../imap-2002.RC8'
Server API Apache
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/lib/php.ini
Debug Build no
Thread Safety disabled
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 28 19:00:02 2025 UTC |
I run httpd with -X in gdb and here is a backtrace of the segfault. (gdb) run -X The program being debugged has been started already. Start it from the beginning? (y or n) y Starting program: /usr/sbin/httpd -X [New Thread 1024 (LWP 25507)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1024 (LWP 25507)] 0x402bf82f in zend_do_pass_param (param=0xbfffd4dc, op=65, offset=2) at zend_compile.c:935 935 zend_compile.c: No such file or directory. in zend_compile.c (gdb) bt #0 0x402bf82f in zend_do_pass_param (param=0xbfffd4dc, op=65, offset=2) at zend_compile.c:935 #1 0x402b5bad in zendparse () at zend_language_parser.c:2220 #2 0x402b78d5 in compile_file (file_handle=0xbffff4e8, type=2) at zend_language_scanner.c:3021 #3 0x402d5872 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at zend.c:808 #4 0x402e2ff6 in php_execute_script (primary_file=0xbffff4e8) at main.c:1383 #5 0x402deb9e in apache_php_module_main (r=0x8180e14, display_source_mode=0) at sapi_apache.c:90 #6 0x402df69e in send_php (r=0x8180e14, display_source_mode=0, filename=0x0) at mod_php4.c:575 #7 0x402df702 in send_parsed_php (r=0x8180e14) at mod_php4.c:590 #8 0x080553f9 in ap_invoke_handler () #9 0x0806a29f in ap_some_auth_required () #10 0x0806a306 in ap_process_request () #11 0x08061156 in ap_child_terminate () #12 0x08061331 in ap_child_terminate () #13 0x080614ac in ap_child_terminate () #14 0x08061b1c in ap_child_terminate () #15 0x0806236c in main () #16 0x400f12eb in __libc_start_main (main=0x8061fb4 <main>, argc=2, ubp_av=0xbffff8f4, init=0x804f3a4 <_init>, fini=0x8099b4c <_fini>, rtld_fini=0x4000c130 <_dl_fini>, stack_end=0xbffff8ec) at ../sysdeps/generic/libc-start.c:129