From:             willw at applied dot co dot uk
Operating system: Windows XP SP2
PHP version:      5.2.0RC1
PHP Bug Type:     COM related
Bug description:  Use of com.typelib_file in PHP.ini causes A/V

Description:
------------
Use of the com.typelib_file to set a text file containing a list of
typelibs causes PHP to crash with an A/V at startup.

Occurs both if PHP.exe is run from command line, or from Apache 1 via
php5apache.dll. Haven't tried other combos.

This worked ok in PHP4, but seems to fail in all the PHP5s that I have
tested. 

Reproduce code:
---------------
Alter a working PHP.ini so that it sets com.typelib_file to point to a
text file. To see the bug, the named file must exist, and contain at least
one entry. It doesn't matter whether the entry is valid.

PHP.ini:
...
[COM]
com.typelib_file = "C:/PHP/typelib_files.txt"
...

contents of typelib_files.txt:
C:\WinNt\System32\activeds.tlb

Expected result:
----------------
(Expected no crash)

Actual result:
--------------
Backtrace:


NTDLL! 7c901010()
begin_read(_zend_ts_hashtable * 0x00fa4c20 _php_com_typelibraries) line 28
+ 12 bytes
zend_ts_hash_find(_zend_ts_hashtable * 0x00fa4c20 _php_com_typelibraries,
char * 0x011007e8, unsigned int 0x00000010, void * * 0x0012f764) line 208
+ 9 bytes
php_com_load_typelib_via_cache(char * 0x011007e8, int 0x00000000, int *
0x0012f7e8, void * * * 0x00fe5028) line 238 + 25 bytes
OnTypeLibFileUpdate(_zend_ini_entry * 0x01194198, char * 0x0114fbb0,
unsigned int 0x00000036, void * 0x00000000, void * 0x00000000, void *
0x00000000, int 0x00000001, void * * * 0x00fe5028) line 149 + 36 bytes
zend_register_ini_entries(_zend_ini_entry * 0x00f3f0c8 ini_entries, int
0x00000003, void * * * 0x00fe5028) line 182 + 56 bytes
zm_startup_com_dotnet(int 0x00000001, int 0x00000003, void * * *
0x00fe5028) line 189 + 18 bytes
zend_startup_module_ex(_zend_module_entry * 0x0115af70, void * * *
0x00fe5028) line 1397 + 28 bytes
zend_hash_apply(_hashtable * 0x00fa6b80 _module_registry, int (void *,
void * * *)* 0x00a61780 _zend_startup_module_ex, void * * * 0x00fe5028)
line 666 + 16 bytes
zend_startup_modules(void * * * 0x00fe5028) line 1444 + 19 bytes
php_module_startup(_sapi_module_struct * 0x10019410 apache_sapi_module,
_zend_module_entry * 0x100197f8 _apache_module_entry, unsigned int
0x00000001) line 1552 + 9 bytes
php_apache_startup(_sapi_module_struct * 0x10019410 apache_sapi_module)
line 289 + 19 bytes
php_init_handler(server_rec * 0x003f8ee8, pool * 0x003f8ec0) line 933 + 10
bytes
APACHECORE! 6ff66730()
APACHE! 0040100f()
KERNEL32! 7c816d4f()


Looking at the source, one appears to be able to fix it by editing
com_dotnet/com_extension.c. The php_com_typelibraries structure is
accessed before it is initialised. Moving the call to zend_ts_hash_init()
above REGISTER_INI_ENTRIES() seems to fix it... but may have side effects
that I don't understand.

-- 
Edit bug report at http://bugs.php.net/?id=38400&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38400&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38400&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38400&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38400&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38400&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38400&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38400&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38400&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38400&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38400&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38400&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38400&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38400&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38400&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38400&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38400&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38400&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38400&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38400&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38400&r=mysqlcfg

Reply via email to