SET_VAR_LONG() causes php to segfault?

From: Date: Tue, 04 Jul 2000 06:28:12 +0000
Subject: SET_VAR_LONG() causes php to segfault?
Groups: php.dev 
Request: Send a blank email to php-dev+get-23417@lists.php.net to get a copy of this message
I've been working at coding the sockets extension for PHP, and upon compiling and simply attempting to run the resulting PHP binary, PHP segfaults. The version of sockets.c/php_sockets.h that I'm working with is newer than the one currently in the repository. GDB backtrace: #0 pam_getenvlist (pamh=0x8138298) at pam_env.c:359 #1 0x8093a8f in zend_hash_find (ht=0x8138298, arKey=0x8109509 "AF_UNIX", nKeyLength=8, pData=0xbffffa88) at zend_hash.c:803 #2 0x80b4839 in php_minit_sockets (type=1, module_number=3) at sockets.c:193 #3 0x80806f0 in zend_startup_module (module=0x8121f20) at zend_API.c:697 #4 0x805e7bc in php_startup_extensions (ptr=0x8120764, count=8) at main.c:719 #5 0x809ddef in php_startup_internal_extensions () at internal_functions.c:63 #6 0x805ea35 in php_module_startup (sf=0x811bd00) at main.c:868 #7 0x805cc31 in main (argc=1, argv=0xbffffbd4) at cgi_main.c:450 #8 0x400b39d3 in __libc_start_main (main=0x805cb40 <main>, argc=1, argv=0xbffffbd4, init=0x805b86c <_init>, fini=0x80f2058 <_fini>, rtld_fini=0x4000ae30 <_dl_fini>, stack_end=0xbffffbcc) at ../sysdeps/generic/libc-start.c:92 The code around the offending line in my code (frame #2): 185 PHP_MINIT_FUNCTION(sockets) 186 { 187 /* Remove comments if you have entries in php.ini 188 REGISTER_INI_ENTRIES(); 189 */ 190 le_destroy = register_list_destructors(destroy_fd_sets, NULL); 191 le_iov = register_list_destructors(destroy_iovec, NULL); 192 193 SET_VAR_LONG("AF_UNIX", AF_UNIX); <-- offending line 194 SET_VAR_LONG("AF_INET", AF_INET); 195 SET_VAR_LONG("SOCK_STREAM", SOCK_STREAM); 196 SET_VAR_LONG("SOCK_DGRAM", SOCK_DGRAM); 197 SET_VAR_LONG("SOCK_RAW", SOCK_RAW); 198 SET_VAR_LONG("SOCK_SEQPACKET", SOCK_SEQPACKET); 199 SET_VAR_LONG("SOCK_RDM", SOCK_RDM); 200 SET_VAR_LONG("MSG_OOB", MSG_OOB); 201 SET_VAR_LONG("MSG_WAITALL", MSG_WAITALL); 202 SET_VAR_LONG("MSG_PEEK", MSG_PEEK); 203 204 return SUCCESS; 205 } Does anyone have a clue about this particular problem, or can I simply not insert variables in the MINIT function? Chris ------ give me life give me pain give me myself again -- tori amos - little earthquakes

« previous php.dev (#23417) next »