Edit report at https://bugs.php.net/bug.php?id=62266&edit=1
ID: 62266 Updated by: cataphr...@php.net Reported by: lance dot lovette at gmail dot com Summary: Custom extension segfaults during xmlParseFile with FPM SAPI Status: Assigned Type: Bug Package: XML related Operating System: CentOS release 6.2 (Final) PHP Version: 5.4Git-2012-06-08 (snap) Assigned To: cataphract Block user comment: N Private report: N New Comment: Ah. Then this was caused by d8bddb9. xmlParserInputBufferCreateFilenameDefault() et al. are called purposely on MINIT (before: RINIT) and your extension is loading after libxml. This can be fixed in two ways. We can either call the original handler from the custom handler if the modules are not initialized, like we now do on _php_libxml_pre_ext_ent_loader, or we can try to set the custom handlers lazily and once on RINIT (not complicated since we don't have to worry about threaded SAPIs, which always do initialization on every RINIT). Both options are ok for MINIT. The first option has the advantage it has predictable behavior on RINIT (whether your extension is request activated before or after the libxml ext, you don't get the custom handlers), but it may have BC impact (some modules may have been relying on the custom handlers and on being loaded after libxml -- which I think they can guarantee if the declare a dependency on the libxml module). Previous Comments: ------------------------------------------------------------------------ [2012-06-11 20:15:02] lance dot lovette at gmail dot com I expected that change to resolve the issue, but it did not. It's now skipping the call to _php_libxml_external_entity_loader but the stack trace is otherwise the same. ------------------------------------------------------------------------ [2012-06-09 16:33:00] cataphr...@php.net Please try using this snapshot: http://snaps.php.net/php5.4-latest.tar.gz For Windows: http://windows.php.net/snapshots/ ------------------------------------------------------------------------ [2012-06-09 16:32:31] cataphr...@php.net Automatic comment on behalf of cataphract Revision: http://git.php.net/?p=php-src.git;a=commit;h=503358c1797e0f7b05fb49f22dd44bc7f517069f Log: Fix bug #62266 ------------------------------------------------------------------------ [2012-06-08 17:56:01] cataphr...@php.net I'll take a look as this was very likely caused by a change I made. ------------------------------------------------------------------------ [2012-06-08 17:45:11] lance dot lovette at gmail dot com Description: ------------ I have a custom extension that has been in use since 2001. When I upgraded to PHP 5.4 it caused php-fpm to segfault. The extension uses xmlParseFile to load an XML configuration file in MINIT. The CLI build of PHP does NOT segfault and functions as expected. Test script: --------------- I created a trivial extension that calls xmlParseFile in MINIT: https://gist.github.com/2896852 Expected result: ---------------- I expect xmlParseFile to succeed. Actual result: -------------- Output from configure, a gdb backtrace and a list of modules and phpinfo when the crashing extension is disabled: https://gist.github.com/2896980 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62266&edit=1