php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32144 Wrong awk version causes havoc (or: fix extensions loading system)
Submitted: 2005-03-01 09:28 UTC Modified: 2005-06-17 16:04 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: ian at snork dot net Assigned: sniper (profile)
Status: Closed Package: Compile Failure
PHP Version: 5.1.* OS: *
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ian at snork dot net
New email:
PHP Version: OS:

 

 [2005-03-01 09:28 UTC] ian at snork dot net
Description:
------------
A PHP build with --with-spl and --with-sqlite will 
segfault at startup in all SAPIs because the SPL extension 
is not initialized at all.  
 
The following patch appears to fix the problem: 
 
--- php5-200503010530.orig/ext/standard/basic_functions.c       
2005-01-18 11:30:05.000000000 +0000 
+++ php5-200503010530/ext/standard/basic_functions.c    
2005-03-01 08:03:14.578643275 +0000 
@@ -1094,6 +1094,9 @@ 
        PHP_MINIT(syslog)(INIT_FUNC_ARGS_PASSTHRU); 
 #endif 
        PHP_MINIT(array)(INIT_FUNC_ARGS_PASSTHRU); 
+#ifdef HAVE_SPL 
+       PHP_MINIT(spl)(INIT_FUNC_ARGS_PASSTHRU); 
+#endif 
        PHP_MINIT(assert)(INIT_FUNC_ARGS_PASSTHRU); 
        PHP_MINIT(url_scanner_ex)
(INIT_FUNC_ARGS_PASSTHRU); 
 #ifdef PHP_CAN_SUPPORT_PROC_OPEN 
 

Expected result:
----------------
$ sapi/cli/php /dev/null 
$ 

Actual result:
--------------
$ sapi/cli/php /dev/null 
Segmentation fault 
$ 

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-01 10:27 UTC] helly@php.net
What is the configure line used? Especially i am interested if spl or sqlite are build shared. And is this a clean cvs checkout or patched somewhere? The reason i ask is that for your problem we have a mechanismn in place already.

Also what is the order of 'phpext_spl_ptr' and 
'phpext_sqlite_ptr' in main/internal_functions_*.c's 'php_builtin_extensions' array?

 [2005-03-01 11:37 UTC] ian at snork dot net
Both SPL and SQLite were built statically into the PHP      
binary. I was using an unpatched daily snapshot (from     
http://snaps.php.net/php5-latest.tar.bz2). The ./configure     
line was:       
       
./configure --without-mime-magic --enable-memory-limit       
--disable-debug --with-layout=GNU       
--with-pear=/usr/share/php --enable-calendar       
--enable-sysvsem --enable-sysvshm --enable-sysvmsg       
--enable-track-vars --enable-trans-sid --enable-bcmath       
--with-bz2 --enable-ctype --with-db4 --with-iconv       
--enable-exif --enable-filepro --enable-ftp --with-gettext       
--enable-mbstring --with-pcre-regex=/usr --enable-shmop       
--enable-sockets --enable-wddx --disable-xml       
--with-expat-dir=/usr --with-xmlrpc --enable-yp       
--with-zlib --with-pgsql=/usr --with-kerberos       
--with-openssl=/usr --with-exec-dir=/usr/lib/php5/libexec       
--prefix=/usr --with-apxs2=/usr/bin/apxs2 --with-regex=php       
--with-config-file-path=/etc/php5/apache2 --disable-rpath       
--with-curl=/usr --with-dom=/usr --with-dom-xslt=/usr       
--with-dom-exslt=/usr --with-zlib-dir=/usr --with-gd=/usr       
--enable-gd-native-ttf --with-jpeg-dir=/usr       
--with-xpm-dir=/usr/X11R6 --with-png-dir=/usr       
--with-freetype-dir=/usr --with-imap=/usr --with-imap-ssl       
--with-mcal=/usr --with-mhash=/usr --without-mm       
--with-mysql=/usr --with-mysqli=/usr/bin/mysql_config       
--with-unixODBC=/usr --enable-xslt=/usr       
--with-xslt-sablot=/usr --with-snmp=/usr       
--without-sybase-ct --with-ttf=/usr --with-t1lib=/usr       
--without-custom-odbc --without-odbc --without-unixODBC       
--without-iodbc --with-sqlite=/usr       
     
And here's how they're ordered in the snapshot sources:     
       
zend_module_entry *php_builtin_extensions[] = {     
        phpext_xmlrpc_ptr,     
        phpext_xml_ptr,     
        phpext_wddx_ptr,     
        phpext_tokenizer_ptr,     
        phpext_sysvshm_ptr,     
        phpext_sysvsem_ptr,     
        phpext_sysvmsg_ptr,     
        phpext_standard_ptr,     
        phpext_sqlite_ptr,     
        phpext_spl_ptr,     
        phpext_sockets_ptr,     
        phpext_snmp_ptr,     
        phpext_simplexml_ptr,     
        phpext_shmop_ptr,     
        phpext_session_ptr,     
        phpext_posix_ptr,     
        phpext_pgsql_ptr,     
        phpext_pcre_ptr,     
        phpext_mysqli_ptr,     
        phpext_mysql_ptr,     
        phpext_mhash_ptr,     
        phpext_mbstring_ptr,     
        phpext_imap_ptr,     
        phpext_iconv_ptr,     
        phpext_gettext_ptr,     
        phpext_gd_ptr,     
        phpext_ftp_ptr,     
        phpext_filepro_ptr,     
        phpext_exif_ptr,     
        phpext_dom_ptr,     
        phpext_dba_ptr,     
        phpext_curl_ptr,     
        phpext_ctype_ptr,     
        phpext_calendar_ptr,     
        phpext_bz2_ptr,     
        phpext_bcmath_ptr,     
        phpext_zlib_ptr,     
        phpext_openssl_ptr,     
        phpext_libxml_ptr,     
};     
    
Without the patch I submitted, moving phpext_spl_ptr back    
or forward in that list did prevent PHP from segfaulting.    
   
After doubled-checking with GDB, it appeared that the SPL  
startup function (zm_startup_spl) was not being called at  
all. 
 
So, I stuck a manual call to PHP_MINIT(spl) in 
basic_functions.c because it seemed the most logical place  
for this.
 [2005-03-01 11:43 UTC] ian at snork dot net
Oops -- I meant to say:  
 
Moving phpext_sqlite_ptr and phpext_spl_ptr around in that 
list did _not_ prevent a segfault. 
 
Sorry. :)
 [2005-03-09 14:31 UTC] helly@php.net
You need to install gawk and rebuild. Please verify (for me it helped).
 [2005-03-09 16:58 UTC] ian at snork dot net
Replacing mawk with gawk solved the problem.

Many thanks.
 [2005-06-17 16:04 UTC] sniper@php.net
The extension loading system is now fixed, it does not make any difference what AWK version is used anymore (HEAD).

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 09:01:38 2025 UTC