#41724 [Opn]: libxml_get_last_error() - errors survice request scope

From: Date: Mon, 18 Jun 2007 10:57:21 +0000
Subject: #41724 [Opn]: libxml_get_last_error() - errors survice request scope
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-113885@lists.php.net to get a copy of this message
ID: 41724 Updated by: thekid@php.net Reported By: thekid@php.net Status: Open Bug Type: XML related Operating System: Any PHP Version: 5CVS-2007-06-18 (CVS) New Comment: This patch should fix the problem: $ cvs diff -u ext/libxml/ cvs diff: Diffing ext/libxml Index: ext/libxml/libxml.c =================================================================== RCS file: /repository/php-src/ext/libxml/libxml.c,v retrieving revision 1.32.2.7.2.11 diff -u -r1.32.2.7.2.11 libxml.c --- ext/libxml/libxml.c 23 Feb 2007 11:12:49 -0000 1.32.2.7.2.11 +++ ext/libxml/libxml.c 18 Jun 2007 10:46:00 -0000 @@ -674,7 +674,7 @@ efree(LIBXML(error_list)); LIBXML(error_list) = NULL; } - + xmlResetLastError(); return SUCCESS; } It adds xmlResetLastError() call to RSHUTDOWN Previous Comments: ------------------------------------------------------------------------ [2007-06-18 10:56:41] thekid@php.net Description: ------------ If one fails to call libxml_clear_error() at the end of a request (via register_shutdown_func() e.g.) errors retrieved by libxml_get_last_error() may come from a different request previously handled in the same webserver child. Reproduce code: --------------- -- test.php -- <?php var_dump(libxml_get_last_error()); ?> -- produce.php -- <?php $d= new DomDocument(); $d->loadXML('malformed'); ?> 1) Call produce.php 2) Call test.php - if it is served up by the same web server child, you will see the error from produce.php Expected result: ---------------- One script should never be able to mess with other scripts' context. Actual result: -------------- libxml_get_last_error() in test.php will report the error produced in produce.php if run inside the same web server child process. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41724&edit=1

« previous php.bugs (#113885) next »