|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-05-28 13:43 UTC] Sjon at hortensius dot net
Description: ------------ The libxml_disable_entity_loader() setting is shared between hits in a FPM process. Therefore; our script have the external entity-loader randomly enabled/disabled. Test script: --------------- <?php die(var_dump(libxml_disable_entity_loader(false))); Expected result: ---------------- The default setting (which is true since 5.4.13) should always be var_dump-ed Actual result: -------------- since this setting is remembered in the thread; after a while all hits return false PatchesPull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 18:00:02 2025 UTC |
For mark at netalico dot com: The workaround for something like Magento (not required for CE>1.9.2.0 when a workaround was added) is to add this line to the start of your script: if (function_exists('libxml_disable_entity_loader')) { libxml_disable_entity_loader(false); }Can someone test this simple fix proposal diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c index d88860c..bfc1224 100644 --- a/ext/libxml/libxml.c +++ b/ext/libxml/libxml.c @@ -848,7 +848,6 @@ static PHP_MINIT_FUNCTION(libxml) if (sapi_module.name) { static const char * const supported_sapis[] = { "cgi-fcgi", - "fpm-fcgi", "litespeed", NULL };@remi Just noticed that there's a bug report for this. We're shipping the following patch since noticing the issue ourself: diff -Naur php-7.2.0.orig/ext/libxml/libxml.c php-7.2.0/ext/libxml/libxml.c --- php-7.2.0.orig/ext/libxml/libxml.c 2017-11-12 19:03:42.890478753 +0100 +++ php-7.2.0/ext/libxml/libxml.c 2017-11-12 19:03:58.510298201 +0100 @@ -880,13 +880,14 @@ xmlSetGenericErrorFunc(NULL, php_libxml_error_handler); xmlParserInputBufferCreateFilenameDefault(php_libxml_input_buffer_create_filename); xmlOutputBufferCreateFilenameDefault(php_libxml_output_buffer_create_filename); - - /* Enable the entity loader by default. This ensures that - * other threads/requests that might have disabled the loader - * do not affect the current request. - */ - LIBXML(entity_loader_disabled) = 0; } + + /* Enable the entity loader by default. This ensures that + * other threads/requests that might have disabled the loader + * do not affect the current request. + */ + LIBXML(entity_loader_disabled) = 0; + return SUCCESS; } No idea which one is better. Just wanted to share this.