ID:               39613
 Updated by:       [EMAIL PROTECTED]
 Reported By:      wharmby at uk dot ibm dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Reproducible crash
 Operating System: Linux RHEL4
 PHP Version:      5CVS-2006-11-24 (snap)
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------

[2006-11-24 09:49:29] wharmby at uk dot ibm dot com

Description:
------------
Using latest 5.2 snapshot (Nov24, 2006 0730 GMT) and 
building on Linux RHEL4 with the following basic 
configuration: 

     ./configure --disable-all --with-imap=/opt/imap-2004g
      --with-imap-ssl --enable-shared 
      --enable-session=shared  --enable-debug 
      --enable-maintainer-zts --enable-cli --disable-cgi

with "extension=session.so" added to php.ini the resulting CLI fails on
startup, i.e. something as simple as "php -m" seg faults. 

Looking at the core produced on the seg fault with GDB gives
the following back trace: 

                http://pastebin.ca/256507

The reason for the fault is that imap initialization assumes
that standard/file initialization has already completed and 
acquired and initialized "file globals". Unfortunately imap 
does not have a defined module  dependency on standard so
the module initialization order is not guaranteed to be
correct.

The reason for the crash in this case is that PHP 5.2 has 
defined a new dependency between standard and session so the
order of session and standard in the startup order will be 
flipped by zend_sort_modules() when it sorts the module_registry. 

With session defined as shared and imap statically linked 
the resulting module initialization order will be 

   session .......imap.....standard 

and we fail due to the unspecified dependency between imap 
and standard

I get same seg fault if imap is also compiled as a shared module; the
key to reproducing the problem is configuring PHP with imap support
with session defined as shared and ZTS enabled.  

If both session and imap are defined as shared the problem 
can be resolved by ordering the php.ini entries as follows: 

                extension = session.so
                extension = imap.so

as this results in a initialization order of 

   session..... standard ...imap 

and all is OK. But with imap linked statically there is no
workaround to the issue

The problem is easily resolved by defining the missing
dependency between imap and standard. 

The following patch adds the necessary dependency:

          http://pastebin.ca/256510


Reproduce code:
---------------
Build with above config on Linux and "php -m" fails with 
a seg fault.

Expected result:
----------------
[EMAIL PROTECTED] php5.2-200611240730]# php -m
[PHP Modules]
date
imap
Reflection
session
standard

[Zend Modules]


Actual result:
--------------
[EMAIL PROTECTED] php5.2-200611240730]# php -m
Segmentation fault (core dumped)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=39613&edit=1

Reply via email to