]> granicus.if.org Git - php/commitdiff
fix leak when using relaxng
authorRob Richards <rrichards@php.net>
Mon, 31 May 2004 11:20:46 +0000 (11:20 +0000)
committerRob Richards <rrichards@php.net>
Mon, 31 May 2004 11:20:46 +0000 (11:20 +0000)
interim fix for isolating our streams handling
- once libxml supports overriding streams this should be changed
  for security reasons

ext/libxml/libxml.c

index a6e68a21df7afad0fef7585d49085c9c9baf0365..cb0519631adc1fbe2ae12f98bdf494f48ef2406f 100644 (file)
@@ -40,6 +40,9 @@
 #include <libxml/tree.h>
 #include <libxml/uri.h>
 #include <libxml/xmlerror.h>
+#ifdef LIBXML_SCHEMAS_ENABLED
+#include <libxml/relaxng.h>
+#endif
 
 #include "php_libxml.h"
 
@@ -241,7 +244,11 @@ static void php_libxml_init_globals(php_libxml_globals *libxml_globals_p TSRMLS_
 int php_libxml_streams_IO_match_wrapper(const char *filename)
 {
        TSRMLS_FETCH();
-       return php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC) ? 1 : 0;
+
+       if (zend_is_executing(TSRMLS_C)) {
+               return php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC) ? 1 : 0;
+       }
+       return 0;
 }
 
 void *php_libxml_streams_IO_open_wrapper(const char *filename, const char *mode, const int read_only)
@@ -408,6 +415,9 @@ PHP_LIBXML_API void php_libxml_initialize() {
 
 PHP_LIBXML_API void php_libxml_shutdown() {
        if (_php_libxml_initialized) {
+#if defined(LIBXML_SCHEMAS_ENABLED)
+               xmlRelaxNGCleanupTypes();
+#endif
                xmlCleanupParser();
                zend_hash_destroy(&php_libxml_exports);
                _php_libxml_initialized = 0;