From: piotrek dot pokora at gmail dot com Operating system: Linux/Debian PHP version: 5.4.11 Package: CGI/CLI related Bug Type: Bug Bug description:php_libxml_initialize overwrites global entity loader
Description: ------------ php_libxml_initialize function in ext/libxml sets global entity loader via xmlSetExternalEntityLoader(_php_libxml_pre_ext_ent_loader). This affects any library which is loaded implicitly during loading phase and triggers segmentation fault. Gdb output: Program received signal SIGSEGV, Segmentation fault. _zend_hash_index_update_or_next_insert (ht=0xd1b910, h=0, pData=<value optimized out>, nDataSize=16, pDest=0x0, flag=1) at /app/php-5.4.8/Zend/zend_hash.c:385 385 /app/php-5.4.8/Zend/zend_hash.c: No such file or directory. in /app/php-5.4.8/Zend/zend_hash.c (gdb) bt #0 _zend_hash_index_update_or_next_insert (ht=0xd1b910, h=0, pData=<value optimized out>, nDataSize=16, pDest=0x0, flag=1) at /app/php-5.4.8/Zend/zend_hash.c:385 #1 0x000000000068f600 in zend_list_insert (ptr=<value optimized out>, type=<value optimized out>) at /app/php-5.4.8/Zend/zend_list.c:46 #2 0x000000000068f61e in zend_register_resource (rsrc_result=0x0, rsrc_pointer=0x7ffff7fad2c8, rsrc_type=-134556984) at /app/php-5.4.8/Zend/zend_list.c:98 #3 0x00000000006392d6 in php_stream_context_alloc () at /app/php-5.4.8/main/streams/streams.c:2199 #4 0x0000000000455035 in php_libxml_streams_IO_open_wrapper (filename=0xea1990 "/app/libgda/share/libgda-4.0/dtd/libgda-array.dtd", mode=0xa71434 "rb", read_only=1) at /app/php-5.4.8/ext/libxml/libxml.c:334 #5 0x000000000045509f in php_libxml_streams_IO_open_read_wrapper (URI=0x7ffff7fad2c8 "0\320\372\367\377\177", enc=XML_CHAR_ENCODING_NONE) at /app/php-5.4.8/ext/libxml/libxml.c:345 #6 php_libxml_input_buffer_create_filename (URI=0x7ffff7fad2c8 "0\320\372\367\377\177", enc=XML_CHAR_ENCODING_NONE) at /app/php-5.4.8/ext/libxml/libxml.c:386 #7 0x00007ffff6dc7d8d in xmlNewInputFromFile () from /usr/lib/libxml2.so.2 #8 0x000000000045681b in _php_libxml_pre_ext_ent_loader (URL=0xea1990 "/app/libgda/share/libgda-4.0/dtd/libgda-array.dtd", ID=0x0, context=0xe9e0b0) at /app/php-5.4.8/ext/libxml/libxml.c:694 #9 0x00007ffff6e8d59b in xmlSAX2ResolveEntity () from /usr/lib/libxml2.so.2 #10 0x00007ffff6de35a5 in xmlSAXParseDTD () from /usr/lib/libxml2.so.2 #11 0x00007ffff5687307 in gda_init () at gda-init.c:198 #12 0x00007ffff610c249 in midgard_init () at src/midgard.c:138 #13 0x00007ffff639cb61 in zm_startup_midgard2 (type=1, module_number=28) at /app/midgard-php5-10.05.7/midgard.c:324 Steps from #11 to #8 clearly shows that php's hook is wrong in this case. It doesn't happen with PHP 5.3, where global hook is not set. -- Edit bug report at https://bugs.php.net/bug.php?id=64017&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64017&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64017&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64017&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64017&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64017&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64017&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64017&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64017&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64017&r=support Expected behavior: https://bugs.php.net/fix.php?id=64017&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64017&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64017&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64017&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64017&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64017&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64017&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64017&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64017&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64017&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64017&r=mysqlcfg