diff options
Diffstat (limited to 'ext/dom/document.c')
-rw-r--r-- | ext/dom/document.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c index f105f6d7fe..095f96dc09 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1979,14 +1979,15 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type xmlDoc *docp; dom_object *intern; char *source = NULL, *valid_file = NULL; - int source_len = 0; + int source_len = 0, valid_opts = 0; + long flags = 0; xmlSchemaParserCtxtPtr parser; xmlSchemaPtr sptr; xmlSchemaValidCtxtPtr vptr; int is_valid; char resolved_path[MAXPATHLEN + 1]; - if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op", &id, dom_document_class_entry, &source, &source_len) == FAILURE) { + if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), "Op|l", &id, dom_document_class_entry, &source, &source_len, &flags) == FAILURE) { return; } @@ -2035,6 +2036,13 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type RETURN_FALSE; } +#if LIBXML_VERSION >= 20614 + if (flags & XML_SCHEMA_VAL_VC_I_CREATE) { + valid_opts |= XML_SCHEMA_VAL_VC_I_CREATE; + } +#endif + + xmlSchemaSetValidOptions(vptr, valid_opts); xmlSchemaSetValidErrors(vptr, php_libxml_error_handler, php_libxml_error_handler, vptr); is_valid = xmlSchemaValidateDoc(vptr, docp); xmlSchemaFree(sptr); @@ -2048,14 +2056,14 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type } /* }}} */ -/* {{{ proto boolean dom_document_schema_validate_file(string filename); */ +/* {{{ proto boolean dom_document_schema_validate_file(string filename, int flags); */ PHP_FUNCTION(dom_document_schema_validate_file) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE); } /* }}} end dom_document_schema_validate_file */ -/* {{{ proto boolean dom_document_schema_validate(string source); */ +/* {{{ proto boolean dom_document_schema_validate(string source, int flags); */ PHP_FUNCTION(dom_document_schema_validate_xml) { _dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING); |