summaryrefslogtreecommitdiff
path: root/ext/libxml/libxml.c
diff options
context:
space:
mode:
authorSean Finney <seanius@debian.org>2009-06-30 19:11:48 +0200
committerSean Finney <seanius@debian.org>2009-06-30 19:11:48 +0200
commitd3a8757891280dc6650ca7eead67830c794b0e7b (patch)
treefd17e4142019fe7af4eeb7a5c9e0bdade5388418 /ext/libxml/libxml.c
parent84f4ca9b07fe5b73d840258f4aa7c1eb534c4253 (diff)
downloadphp-d3a8757891280dc6650ca7eead67830c794b0e7b.tar.gz
Imported Upstream version 5.3.0upstream/5.3.0
Diffstat (limited to 'ext/libxml/libxml.c')
-rw-r--r--ext/libxml/libxml.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 7d8b49cbb..407074b5c 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: libxml.c,v 1.32.2.7.2.15.2.11 2009/03/14 17:30:28 rrichards Exp $ */
+/* $Id: libxml.c,v 1.32.2.7.2.15.2.13 2009/06/23 13:44:24 bjori Exp $ */
#define IS_EXT_MODULE
@@ -68,6 +68,7 @@ static PHP_FUNCTION(libxml_use_internal_errors);
static PHP_FUNCTION(libxml_get_last_error);
static PHP_FUNCTION(libxml_clear_errors);
static PHP_FUNCTION(libxml_get_errors);
+static PHP_FUNCTION(libxml_disable_entity_loader);
static zend_class_entry *libxmlerror_class_entry;
@@ -91,7 +92,7 @@ ZEND_BEGIN_ARG_INFO(arginfo_libxml_set_streams_context, 0)
ZEND_ARG_INFO(0, context)
ZEND_END_ARG_INFO()
-ZEND_BEGIN_ARG_INFO(arginfo_libxml_use_internal_errors, 0)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_libxml_use_internal_errors, 0, 0, 0)
ZEND_ARG_INFO(0, use_errors)
ZEND_END_ARG_INFO()
@@ -104,6 +105,10 @@ ZEND_END_ARG_INFO()
ZEND_BEGIN_ARG_INFO(arginfo_libxml_clear_errors, 0)
ZEND_END_ARG_INFO()
+ZEND_BEGIN_ARG_INFO_EX(arginfo_libxml_disable_entity_loader, 0, 0, 0)
+ ZEND_ARG_INFO(0, disable)
+ZEND_END_ARG_INFO()
+
/* }}} */
/* {{{ extension definition structures */
@@ -113,6 +118,7 @@ static const zend_function_entry libxml_functions[] = {
PHP_FE(libxml_get_last_error, arginfo_libxml_get_last_error)
PHP_FE(libxml_clear_errors, arginfo_libxml_clear_errors)
PHP_FE(libxml_get_errors, arginfo_libxml_get_errors)
+ PHP_FE(libxml_disable_entity_loader, arginfo_libxml_disable_entity_loader)
{NULL, NULL, NULL}
};
@@ -344,6 +350,12 @@ static int php_libxml_streams_IO_close(void *context)
}
static xmlParserInputBufferPtr
+php_libxml_input_buffer_noload(const char *URI, xmlCharEncoding enc)
+{
+ return NULL;
+}
+
+static xmlParserInputBufferPtr
php_libxml_input_buffer_create_filename(const char *URI, xmlCharEncoding enc)
{
xmlParserInputBufferPtr ret;
@@ -820,6 +832,31 @@ static PHP_FUNCTION(libxml_clear_errors)
}
/* }}} */
+/* {{{ proto bool libxml_disable_entity_loader([boolean disable])
+ Disable/Enable ability to load external entities */
+static PHP_FUNCTION(libxml_disable_entity_loader)
+{
+ zend_bool disable = 1;
+ xmlParserInputBufferCreateFilenameFunc old;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &disable) == FAILURE) {
+ return;
+ }
+
+ if (disable == 0) {
+ old = xmlParserInputBufferCreateFilenameDefault(php_libxml_input_buffer_create_filename);
+ } else {
+ old = xmlParserInputBufferCreateFilenameDefault(php_libxml_input_buffer_noload);
+ }
+
+ if (old == php_libxml_input_buffer_noload) {
+ RETURN_TRUE;
+ }
+
+ RETURN_FALSE;
+}
+/* }}} */
+
/* {{{ Common functions shared by extensions */
int php_libxml_xmlCheckUTF8(const unsigned char *s)
{