summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorRob Richards <rrichards@php.net>2004-05-31 11:20:46 (GMT)
committerRob Richards <rrichards@php.net>2004-05-31 11:20:46 (GMT)
commit1d82c42493125f7fbdaf0a9bae6051070db885b4 (patch)
tree01cf7653baea4eaff3c510cc1afe9dd723329c89 /ext
parent846c5a252ec4f90319d15aa4cf24ec45b2a8ac06 (diff)
downloadphp-1d82c42493125f7fbdaf0a9bae6051070db885b4.tar.gz
fix leak when using relaxng
interim fix for isolating our streams handling - once libxml supports overriding streams this should be changed for security reasons
Diffstat (limited to 'ext')
-rw-r--r--ext/libxml/libxml.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index a6e68a2..cb05196 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -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;