php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9764 Extensions from php.ini get loaded several times per process
Submitted: 2001-03-15 06:43 UTC Modified: 2001-03-17 18:46 UTC
From: ab@php.net Assigned:
Status: Closed Package: PHP options/info functions
PHP Version: 4.0 Latest CVS (15/03/2001) OS: Linux 2.2.18 / glibc 2.2.2
Private report: No CVE-ID: None
 [2001-03-15 06:43 UTC] ab@php.net
PHP4 under Apache tries to load extensions from php.ini

several times per process causing 'duplicate name' warnings

Also on the second (and next) loading extension name passed

to phpdl() in damaged form.



Investigation showed that problem is in the main/php_ini.c:

1. php_load_function_extension_cb() allocates extension name using estrdup but global llist with extensions declared as persistent. It keeps references to deallocated extensions' names causing damaged names passed to phpdl(). 

2. php_startup_loaded_extensions() doesn't free llist after

loading extensions, so next call to php_init_config() (per-process) will double this list.



Solution is to deallocate llist after loading extensions in php_startup_loaded_extensions. Then (1) wouldn't be a problem at all.



Proposed fix:



--- main/php_ini.c.orig Tue Mar  6 13:38:55 2001

+++ main/php_ini.c      Thu Mar 15 13:12:04 2001

@@ -165,6 +165,8 @@

 {

        if(php_load_extension_list) {

                zend_llist_apply(php_load_extension_list, php_startup_loaded_extension_cb);

+               zend_llist_destroy(php_load_extension_list);

+               php_load_extension_list = NULL;

        }

        return SUCCESS;

}

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-17 18:46 UTC] sniper@php.net
Fixed in CVS. (By Zeev, but not with this patch..)

--Jani

 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Feb 20 05:01:26 2019 UTC