|
|
|
@ -1973,14 +1973,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; |
|
|
|
} |
|
|
|
|
|
|
|
@ -2029,6 +2030,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); |
|
|
|
@ -2042,14 +2050,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); |
|
|
|
|